mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 15:13:44 -04:00
af_unix: Don't check SOCK_DEAD in unix_stream_read_skb().
unix_stream_read_skb() checks SOCK_DEAD only when the dequeued skb is OOB skb. unix_stream_read_skb() is called for a SOCK_STREAM socket in SOCKMAP when data is sent to it. The function is invoked via sk_psock_verdict_data_ready(), which is set to sk->sk_data_ready(). During sendmsg(), we check if the receiver has SOCK_DEAD, so there is no point in checking it again later in ->read_skb(). Also, unix_read_skb() for SOCK_DGRAM does not have the test either. Let's remove the SOCK_DEAD test in unix_stream_read_skb(). Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20250702223606.1054680-3-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b429a5ad19
commit
772f01049c
@@ -2803,14 +2803,6 @@ static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
|
||||
if (unlikely(skb == READ_ONCE(u->oob_skb))) {
|
||||
bool drop = false;
|
||||
|
||||
unix_state_lock(sk);
|
||||
|
||||
if (sock_flag(sk, SOCK_DEAD)) {
|
||||
unix_state_unlock(sk);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_SOCKET_CLOSE);
|
||||
return -ECONNRESET;
|
||||
}
|
||||
|
||||
spin_lock(&sk->sk_receive_queue.lock);
|
||||
if (likely(skb == u->oob_skb)) {
|
||||
WRITE_ONCE(u->oob_skb, NULL);
|
||||
@@ -2818,8 +2810,6 @@ static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
|
||||
}
|
||||
spin_unlock(&sk->sk_receive_queue.lock);
|
||||
|
||||
unix_state_unlock(sk);
|
||||
|
||||
if (drop) {
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_UNIX_SKIP_OOB);
|
||||
return -EAGAIN;
|
||||
|
||||
Reference in New Issue
Block a user