BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Breno Leitao" <leitao@debian.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/7] af_iucv: take socket lock around SO_MSGSIZE getsockopt
Date: Sat, 16 May 2026 08:34:33 +0000	[thread overview]
Message-ID: <20260516083434.6FC23C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260515-getsock_four-v2-1-0d8eed952627@debian.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The commit message incorrectly claims the bug is unexploitable and targets the patch to `net-next` without a `Fixes` tag, bypassing stable backports for a reachable NULL pointer dereference or use-after-free.
--

commit 2d366eacb5715c7a757195706a39c7382bd391e0
Author: Breno Leitao <leitao@debian.org>
af_iucv: take socket lock around SO_MSGSIZE getsockopt

This commit adds socket locking around the SO_MSGSIZE case in
iucv_sock_getsockopt() to prevent concurrent modifications to hs_dev.
The commit message states this is purely defensive and targets net-next.

> This is not an exploitable bug. iucv_sock_close() is the only writer
> of iucv->hs_dev and only runs from the protocol release callback,
> which the socket layer invokes after the last file reference drops.
> The getsockopt() syscall holds an fd reference for its entire
> duration via fdget()/fdput(), so iucv_sock_close() cannot run
> concurrently with the SO_MSGSIZE read on the same socket.

Is it strictly true that iucv_sock_close() only runs from the release
callback?

Looking at iucv_sock_recvmsg(), it appears to directly invoke
iucv_sock_close() when the message limit is exceeded:

net/iucv/af_iucv.c:iucv_sock_recvmsg() {
        ...
        if (atomic_read(&iucv->msg_recv) > iucv->msglimit) {
                ...
                iucv_sock_close(sk);
                ...
        }
        ...
}

Since recvmsg() executes with an active file descriptor reference, could
this path be triggered concurrently with a getsockopt() call evaluating
SO_MSGSIZE on the same socket?

If so, evaluating iucv->hs_dev and then dereferencing iucv->hs_dev->mtu
in getsockopt() before this patch could be vulnerable to a race with
iucv_sock_close(), potentially leading to a null pointer dereference or
use-after-free.

> Note: For the reason above, it doesn't contain a "Fixes" tag, and is
> aiming at net-next instead of net.

If the concurrent recvmsg() path is reachable, does this patch actually fix
an exploitable issue rather than being a purely defensive cleanup?

If it does fix a reachable crash, should it include a Fixes tag and be
targeted at the net tree so it gets backported to stable kernels?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260515-getsock_four-v2-0-0d8eed952627@debian.org?part=1

  parent reply	other threads:[~2026-05-16  8:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15  8:32 [PATCH net-next v2 0/7] net: convert atm/xdp/af_iucv/l2tp_ppp/rxrpc/tipc to getsockopt_iter Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 1/7] af_iucv: take socket lock around SO_MSGSIZE getsockopt Breno Leitao
2026-05-15 20:45   ` Stanislav Fomichev
2026-05-16  8:34   ` sashiko-bot [this message]
2026-05-15  8:32 ` [PATCH net-next v2 2/7] af_iucv: convert to getsockopt_iter Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 3/7] atm: " Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 4/7] xdp: " Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 5/7] l2tp: ppp: " Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 6/7] rxrpc: " Breno Leitao
2026-05-15  8:32 ` [PATCH net-next v2 7/7] tipc: " Breno Leitao

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=20260516083434.6FC23C19425@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leitao@debian.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox