Subject: Re: [PATCH net-next] netfilter: xt_owner: no longer acquire sk_callback_lock in mt_owner()

From: Florian Westphal <[email-masked]>
Date: Tue, 24 Feb 2026 13:52:19 +0100

Eric Dumazet <[email-masked]> wrote:
> After commit 983512f3a87f ("net: Drop the lock in skb_may_tx_timestamp()")
> from Sebastian Andrzej Siewior, apply the same logic in mt_owner()
> to avoid touching sk_callback_lock.
> -	read_lock_bh(&sk->sk_callback_lock);
> -	filp = sk->sk_socket ? sk->sk_socket->file : NULL;
> +	/* The sk pointer remains valid as long as the skb is. The sk_socket and
> +	 * file pointer may become NULL if the socket is closed. Both structures
> +	 * (including file->cred) are RCU freed which means they can be accessed
> +	 * within a RCU read section.
> +	 */
> +	rcu_read_lock();
> +	sock = READ_ONCE(sk->sk_socket);
> +	filp = sock ? READ_ONCE(sock->file) : NULL;

Thanks for doing this Eric!

Minor nit: rcu_read_lock is already acquired from nf_hook() helper, so
we aleays have it in both iptables and nftables.

Reviewed-by: Florian Westphal <[email-masked]>