Subject: RE: [PATCH bpf] sock_map: add a cond_resched() in sock_hash_free()

From: John Fastabend <[email-masked]>
Date: Fri, 06 Sep 2024 14:32:35 -0700

Eric Dumazet wrote:
> 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 <[email-masked]>
> Signed-off-by: Eric Dumazet <[email-masked]>
> Cc: John Fastabend <[email-masked]>
> Cc: Jakub Sitnicki <[email-masked]>
> ---
>  net/core/sock_map.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> index d3dbb92153f2fe7f1ddc8e35b495533fbf60a8cb..724b6856fcc3e9fd51673d31927cfd52d5d7d0aa 100644
> --- a/net/core/sock_map.c
> +++ b/net/core/sock_map.c
> @@ -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 */
> -- 
> 2.46.0.469.g59c65b2a67-goog
> 

Thanks, looks good to me.

Acked-by: John Fastabend <[email-masked]>