]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sock_map: Add a cond_resched() in sock_hash_free()
authorEric Dumazet <edumazet@google.com>
Fri, 6 Sep 2024 15:44:49 +0000 (15:44 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 11 Sep 2024 20:16:04 +0000 (22:16 +0200)
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
net/core/sock_map.c

index d3dbb92153f2fe7f1ddc8e35b495533fbf60a8cb..724b6856fcc3e9fd51673d31927cfd52d5d7d0aa 100644 (file)
@@ -1183,6 +1183,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 */