[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1519323485.55655.59.camel@gmail.com>
Date: Thu, 22 Feb 2018 10:18:05 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Yonghong Song <yhs@...com>, ast@...com, daniel@...earbox.net,
edumazet@...gle.com, netdev@...r.kernel.org
Cc: kernel-team@...com
Subject: Re: [PATCH bpf v2] bpf: fix rcu lockdep warning for lpm_trie
map_free callback
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 <edumazet@...gle.com>
> Suggested-by: Eric Dumazet <edumazet@...gle.com>
> Signed-off-by: Yonghong Song <yhs@...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 <edumazet@...gle.com>
Powered by blists - more mailing lists