Commit b1339be9 authored by Eric Dumazet's avatar Eric Dumazet Committed by Daniel Borkmann
Browse files

sock_map: Add a cond_resched() in sock_hash_free()



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: 75e68e5b ("bpf, sockhash: Synchronize delete from bucket list on map free")
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20240906154449.3742932-1-edumazet@google.com
parent fdfd9d82
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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 */