On Wed, Feb 26, 2025 at 09:22:40PM +0800, Jiayuan Chen wrote:
> Use RCU lock to protect sk_socket, preventing concurrent close and release
> by another thread.
>
> Because TCP/UDP are already within a relatively large critical section:
> '''
> ip_local_deliver_finish
> rcu_read_lock
> ip_protocol_deliver_rcu
> tcp_rcv/udp_rcv
> rcu_read_unlock
> '''
>
> Adding rcu_read_{un}lock() at the entrance and exit of sk_data_ready
> will not increase performance overhead.
>
> Reported-by: [email protected]
> Closes:
> https://lore.kernel.org/bpf/[email protected]/
> Signed-off-by: Jiayuan Chen <[email protected]>
sock_def_readable() already acquires RCU read lock anyway.
Reviewed-by: Cong Wang <[email protected]>
Thanks!