af_unix: fix inq_len accounting and consumed OOB skb handling in unix_stream_read_skb()
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest2 patches 0 repliesNew
Changes in v2 from the cover letter
- 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.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | af_unix: decrement u->inq_len when skipping unread OOB skb in manage_oob()net/ | +1 | 0 replies | |
| 2/2 | af_unix: skip consumed OOB skb and pull consumed bytes in unix_stream_read_skb()net/ | +16 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH net v2 0/2] af_unix: fix inq_len accounting and consumed OOB skb handling in unix_stream_read_skb()
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(+)