summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-09-06 18:44:49 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-10-04 17:28:58 +0300
commit80bd490ac0a3b662a489e17d8eedeb1e905a3d40 (patch)
treebcfe07e5f47171037f5fde5c093193bcb2c547e2 /net
parent7eebbdde4b947b41ee421478ebef04794a6111c5 (diff)
downloadlinux-80bd490ac0a3b662a489e17d8eedeb1e905a3d40.tar.xz
sock_map: Add a cond_resched() in sock_hash_free()
[ Upstream commit b1339be951ad31947ae19bc25cb08769bf255100 ] Several syzbot soft lockup reports all have in common sock_hash_free() If a map with a large number of buckets is destroyed, we need to yield the cpu when needed. Fixes: 75e68e5bf2c7 ("bpf, sockhash: Synchronize delete from bucket list on map free") Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20240906154449.3742932-1-edumazet@google.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/sock_map.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index a37143d181f9..2afac40bb83c 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -1171,6 +1171,7 @@ static void sock_hash_free(struct bpf_map *map)
sock_put(elem->sk);
sock_hash_free_elem(htab, elem);
}
+ cond_resched();
}
/* wait for psock readers accessing its map link */