On Thu, 2018-02-22 at 10:10 -0800, Yonghong Song wrote: > Commit 9a3efb6b661f ("bpf: fix memory leak in lpm_trie map_free callback > function") > fixed a memory leak and removed unnecessary locks in map_free callback > function. > Unfortrunately, it introduced a lockdep warning. When lockdep checking is > turned on, > running tools/testing/selftests/bpf/test_lpm_map will have: >
> Fixes: 9a3efb6b661f ("bpf: fix memory leak in lpm_trie map_free callback > function") > Reported-by: Eric Dumazet <eduma...@google.com> > Suggested-by: Eric Dumazet <eduma...@google.com> > Signed-off-by: Yonghong Song <y...@fb.com> > --- > kernel/bpf/lpm_trie.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > v1 -> v2: > . fix sparse warning which is introduced by v1, suggested by Eric. > > diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c > index a75e02c..b4b5b81 100644 > --- a/kernel/bpf/lpm_trie.c > +++ b/kernel/bpf/lpm_trie.c > @@ -569,8 +569,7 @@ static void trie_free(struct bpf_map *map) > slot = &trie->root; > > for (;;) { > - node = rcu_dereference_protected(*slot, > - lockdep_is_held(&trie->lock)); > + node = rcu_dereference_protected(*slot, 1); > if (!node) > goto out; SGTM, thanks ! Reviewed-by: Eric Dumazet <eduma...@google.com>