Skip to content

af_unix: Fix inq_len and scm_stat.nr_fds accounting leaks

Siddharth Chintamaneni linux-kselftest lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4af_unix: Fix inq_len leak when skipping unread OOB skb.net/unix/af_unix.c+1 -00 replies
2/4af_unix: Fix scm_stat.nr_fds leaks for OOB skb.net/unix/af_unix.c+13 -30 replies
3/4af_unix: Fix scm_stat.nr_fds leak in unix_dgram_disconnected().net/unix/af_unix.c+28 -240 replies
4/4selftest: af_unix: Test SIOCINQ and scm_fds with OOB and dgram disconnect.tools/testing/selftests/net/af_unix/msg_oob.c tools/testing/selftests/net/af_unix/scm_rights.c+119 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net 0/4] af_unix: Fix inq_len and scm_stat.nr_fds accounting leaks

This series fixes receive-queue accounting leaks of u->inq_len and u->scm_stat.nr_fds in AF_UNIX sockets, along with selftests:

- Patch 1 fixes a u->inq_len leak in manage_oob() when an unconsumed out-of-band (MSG_OOB) skb is skipped and dropped during a normal read.
- Patch 2 fixes u->scm_stat.nr_fds leaks when an OOB skb is skipped or freed in manage_oob(), unix_stream_recv_urg(), and unix_stream_read_skb().
- Patch 3 fixes a u->scm_stat.nr_fds leak in unix_dgram_disconnected() when purging queued skbs from sk->sk_receive_queue on disconnect.
- Patch 4 adds SIOCINQ and scm_fds (/proc/self/fdinfo/<fd>) checks to the msg_oob and scm_rights selftests.

Siddharth Chintamaneni (4):
af_unix: Fix inq_len leak when skipping unread OOB skb.
af_unix: Fix scm_stat.nr_fds leaks for OOB skb.
af_unix: Fix scm_stat.nr_fds leak in unix_dgram_disconnected().
selftest: af_unix: Test SIOCINQ and scm_fds with OOB and dgram
disconnect.

 net/unix/af_unix.c                            |  69 ++++++-----
 tools/testing/selftests/net/af_unix/msg_oob.c |  12 +-
 .../selftests/net/af_unix/scm_rights.c        | 108 ++++++++++++++++++
 3 files changed, 161 insertions(+), 28 deletions(-)
Signature · 1 line
2.43.0