[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250623-couch-pragmatisch-c0155fd10a11@brauner>
Date: Mon, 23 Jun 2025 14:12:14 +0200
From: Christian Brauner <brauner@...nel.org>
To: Kuniyuki Iwashima <kuni1840@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Rao Shoaib <rao.shoaib@...cle.com>, Kuniyuki Iwashima <kuniyu@...gle.com>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net 3/4] af_unix: Don't set -ECONNRESET for consumed
OOB skb.
On Wed, Jun 18, 2025 at 09:13:57PM -0700, Kuniyuki Iwashima wrote:
> From: Kuniyuki Iwashima <kuniyu@...gle.com>
>
> Christian Brauner reported that even after MSG_OOB data is consumed,
> calling close() on the receiver socket causes the peer's recv() to
> return -ECONNRESET:
>
> 1. send() and recv() an OOB data.
>
> >>> from socket import *
> >>> s1, s2 = socketpair(AF_UNIX, SOCK_STREAM)
> >>> s1.send(b'x', MSG_OOB)
> 1
> >>> s2.recv(1, MSG_OOB)
> b'x'
>
> 2. close() for s2 sets ECONNRESET to s1->sk_err even though
> s2 consumed the OOB data
>
> >>> s2.close()
> >>> s1.recv(10, MSG_DONTWAIT)
> ...
> ConnectionResetError: [Errno 104] Connection reset by peer
>
> Even after being consumed, the skb holding the OOB 1-byte data stays in
> the recv queue to mark the OOB boundary and break recv() at that point.
>
> This must be considered while close()ing a socket.
>
> Let's skip the leading consumed OOB skb while checking the -ECONNRESET
> condition in unix_release_sock().
>
> Fixes: 314001f0bf92 ("af_unix: Add OOB support")
> Reported-by: Christian Brauner <brauner@...nel.org>
> Closes: https://lore.kernel.org/netdev/20250529-sinkt-abfeuern-e7b08200c6b0@brauner/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...gle.com>
> ---
Thanks for fixing this!
Acked-by: Christian Brauner <brauner@...nel.org>
Powered by blists - more mailing lists