[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251218150114.250048-3-axboe@kernel.dk>
Date: Thu, 18 Dec 2025 07:59:14 -0700
From: Jens Axboe <axboe@...nel.dk>
To: netdev@...r.kernel.org
Cc: io-uring@...r.kernel.org,
kuba@...nel.org,
kuniyu@...gle.com,
willemb@...gle.com,
Jens Axboe <axboe@...nel.dk>,
stable@...r.kernel.org,
Julian Orth <ju.orth@...il.com>
Subject: [PATCH 2/2] af_unix: only post SO_INQ cmsg for non-error case
As is done for TCP sockets, don't post an SCM_INQ cmsg for an error
case. Only post them for the non-error case, which is when
unix_stream_read_generic will return >= 0.
Cc: stable@...r.kernel.org
Fixes: df30285b3670 ("af_unix: Introduce SO_INQ.")
Reported-by: Julian Orth <ju.orth@...il.com>
Link: https://github.com/axboe/liburing/issues/1509
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
net/unix/af_unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 110d716087b5..72dc5d5bcac8 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3091,7 +3091,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state,
scm_recv_unix(sock, msg, &scm, flags);
do_cmsg = READ_ONCE(u->recvmsg_inq);
- if (do_cmsg || msg->msg_get_inq) {
+ if ((do_cmsg || msg->msg_get_inq) && (copied ?: err) >= 0) {
msg->msg_inq = READ_ONCE(u->inq_len);
if (do_cmsg)
put_cmsg(msg, SOL_SOCKET, SCM_INQ,
--
2.51.0
Powered by blists - more mailing lists