diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-01-24 03:26:46 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-24 05:17:35 +0300 |
commit | d140199af510ad4749dc5e38b7922135258ba5fd (patch) | |
tree | 808db68eb4959518023d42be3657e90162f28457 /kernel/bpf/lpm_trie.c | |
parent | 2acc76cbb7b7ad4f1e35d6c1d973f8cba1dde0bc (diff) | |
download | linux-d140199af510ad4749dc5e38b7922135258ba5fd.tar.xz |
bpf, lpm: fix kfree of im_node in trie_update_elem
We need to initialize im_node to NULL, otherwise in case of error path
it gets passed to kfree() as uninitialized pointer.
Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/lpm_trie.c')
-rw-r--r-- | kernel/bpf/lpm_trie.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c index ba19241d1979..144e9763102f 100644 --- a/kernel/bpf/lpm_trie.c +++ b/kernel/bpf/lpm_trie.c @@ -262,7 +262,7 @@ static int trie_update_elem(struct bpf_map *map, void *_key, void *value, u64 flags) { struct lpm_trie *trie = container_of(map, struct lpm_trie, map); - struct lpm_trie_node *node, *im_node, *new_node = NULL; + struct lpm_trie_node *node, *im_node = NULL, *new_node = NULL; struct lpm_trie_node __rcu **slot; struct bpf_lpm_trie_key *key = _key; unsigned long irq_flags; |