From: Hui Peng <benquike@gmail.com>
To: kuniyu@amazon.com, edumazet@google.com, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Hui Peng <benquike@gmail.com>
Subject: [PATCH net v2 0/2] af_unix: fix inq_len accounting and consumed OOB skb handling in unix_stream_read_skb()
Date: Thu, 24 Sep 2026 07:16:27 +0000 [thread overview]
Message-ID: <20260924071629.2683160-1-benquike@gmail.com> (raw)
This series addresses two OOB skb handling bugs in AF_UNIX stream sockets:
1. Decrement u->inq_len by 1 when manage_oob() unlinks an unread OOB skb,
preventing u->inq_len from remaining permanently inflated and causing
SIOCINQ / FIONREAD to report a stale positive byte count on an empty
socket.
2. Skip zero-length consumed OOB skbs (after releasing SCM rights via
unix_orphan_scm()) and pull UNIXCB(skb).consumed bytes via pskb_pull()
in unix_stream_read_skb(), preventing BPF sockmap from re-delivering
already consumed OOB bytes or partially consumed skb prefixes.
Changes in v2:
- Split into a 2-patch series as requested by Kuniyuki Iwashima.
- Update Fixes: tag to f4e1fb04c123 ("af_unix: Use cached value for
SOCK_STREAM in unix_inq_len().").
- Call unix_orphan_scm(sk, skb) before consume_skb(skb) and use
pskb_pull() instead of skb_pull() to safely handle non-linear paged skbs
as noted by Sashiko.
Hui Peng (2):
af_unix: decrement u->inq_len when skipping unread OOB skb in manage_oob()
af_unix: skip consumed OOB skb and pull consumed bytes in unix_stream_read_skb()
net/unix/af_unix.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
next reply other threads:[~2026-09-24 7:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 7:16 Hui Peng [this message]
2026-09-24 7:16 ` [PATCH net v2 1/2] af_unix: decrement u->inq_len when skipping unread OOB skb in manage_oob() Hui Peng
2026-09-24 7:16 ` [PATCH net v2 2/2] af_unix: skip consumed OOB skb and pull consumed bytes in unix_stream_read_skb() Hui Peng
2026-09-28 7:43 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260924071629.2683160-1-benquike@gmail.com \
--to=benquike@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.