From: Breno Leitao <leitao@debian.org>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 3/6] af_iucv: convert to getsockopt_iter
Date: Thu, 14 May 2026 09:52:05 -0700 [thread overview]
Message-ID: <agX81xwmAFERRs_0@gmail.com> (raw)
In-Reply-To: <20260514124502.5C2ABC2BCB3@smtp.kernel.org>
On Thu, May 14, 2026 at 12:45:01PM +0000, sashiko-bot@kernel.org wrote:
> If iucv->hs_dev is cleared concurrently by another thread holding the lock
> (such as during iucv_sock_close), could the compiler emit two separate
> memory loads for hs_dev since READ_ONCE() isn't used?
It is unclear if there is another concurrent user here, honestly.
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. There is no other writer of hs_dev, and the
aligned pointer load cannot tear on any architecture Linux supports, so the
existing code cannot observe a NULL dereference or use-after-free in practice.
At the same time, SO_MSGLIMIT has the lock:
case SO_MSGLIMIT:
lock_sock(sk);
val = (iucv->path != NULL) ? iucv->path->msglim /* connected */
: iucv->msglimit; /* default */
release_sock(sk);
break;
So, although this is not an issue per-se, it is an extra safe to get a lock
around iucv->hs_dev in SO_MSGSIZE as well, more as a defensive programming than
a bug fix.
That said, my plan is to include this lock protection in my series, but not as
a fix (thus, not sending to 'net')
next prev parent reply other threads:[~2026-05-14 16:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 12:34 [PATCH net-next 0/6] net: convert atm/xdp/af_iucv/l2tp_ppp/rxrpc/tipc to getsockopt_iter Breno Leitao
2026-05-13 12:34 ` [PATCH net-next 1/6] atm: convert " Breno Leitao
2026-05-13 15:29 ` Stanislav Fomichev
2026-05-14 12:45 ` sashiko-bot
2026-05-14 14:52 ` Breno Leitao
2026-05-13 12:34 ` [PATCH net-next 2/6] xdp: " Breno Leitao
2026-05-13 15:30 ` Stanislav Fomichev
2026-05-13 12:34 ` [PATCH net-next 3/6] af_iucv: " Breno Leitao
2026-05-13 15:30 ` Stanislav Fomichev
2026-05-14 12:45 ` sashiko-bot
2026-05-14 16:52 ` Breno Leitao [this message]
2026-05-13 12:34 ` [PATCH net-next 4/6] l2tp: ppp: " Breno Leitao
2026-05-13 15:32 ` Stanislav Fomichev
2026-05-13 12:34 ` [PATCH net-next 5/6] rxrpc: " Breno Leitao
2026-05-13 15:33 ` Stanislav Fomichev
2026-05-13 12:34 ` [PATCH net-next 6/6] tipc: " Breno Leitao
2026-05-13 15:34 ` Stanislav Fomichev
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=agX81xwmAFERRs_0@gmail.com \
--to=leitao@debian.org \
--cc=bpf@vger.kernel.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