From: Alexandra Winter <wintera@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev, Bryam Vargas <hexlabsecurity@proton.me>
Cc: Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH net v2 3/3] net/iucv: send the window update outside message_q.lock
Date: Mon, 24 Aug 2026 14:58:40 +0200 [thread overview]
Message-ID: <732e3384-34a6-4309-b3ae-a8f3eccc7dad@linux.ibm.com> (raw)
In-Reply-To: <20260822111737.8DB721F000E9@smtp.kernel.org>
On 22.08.26 13:17, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
>
> New issues:
> - [High] Redundant concurrent window updates cause spurious socket disconnections due to transient errors.
> - [High] Lockless modification of `sk->sk_state` to `IUCV_DISCONN` in error path corrupts the socket state machine.
>
> Pre-existing issues:
> - [Critical] Concurrent execution of `iucv_sock_recvmsg` and `iucv_sock_close` can lead to a NULL pointer dereference of `iucv->hs_dev`.
> - [High] Lockless read-modify-write sequence on `sk->sk_shutdown` in `iucv_send_ctrl` permanently loses concurrent state updates.
> --
>
> --- Patch [3]: [PATCH net v2 3/3] net/iucv: send the window update outside message_q.lock ---
> commit 38dc50c2f4dfcebf699da12476bf1a5fb529484e
> Author: Bryam Vargas <hexlabsecurity@proton.me>
>
> net/iucv: send the window update outside message_q.lock
>
> This patch moves the window update control message dispatch outside the
> message_q.lock in iucv_sock_recvmsg(). It avoids sleeping in atomic context
> since iucv_send_ctrl() performs a GFP_KERNEL allocation. A boolean flag is
> used to defer the send until after the lock is released.
>
>> diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
>> --- a/net/iucv/af_iucv.c
>> +++ b/net/iucv/af_iucv.c
> [ ... ]
>> @@ -1336,15 +1337,18 @@ static int iucv_sock_recvmsg(struct socket *sock, struct msghdr *msg,
>> iucv_process_message_q(sk);
>> if (iucv->transport == AF_IUCV_TRANS_HIPER &&
>> atomic_read(&iucv->msg_recv) >=
>> - iucv->msglimit / 2) {
>> - err = iucv_send_ctrl(sk, AF_IUCV_FLAG_WIN);
>> - if (err) {
>> - sk->sk_state = IUCV_DISCONN;
>> - sk->sk_state_change(sk);
>> - }
>> - }
>> + iucv->msglimit / 2)
>> + send_win = true;
>> }
>> spin_unlock_bh(&iucv->message_q.lock);
>> +
>> + if (send_win) {
>> + err = iucv_send_ctrl(sk, AF_IUCV_FLAG_WIN);
>
> [Severity: High]
> Because atomic_read(&iucv->msg_recv) is checked inside the lock, but the
> counter is reset later inside afiucv_hs_send() without holding
> message_q.lock, can multiple concurrent calls to iucv_sock_recvmsg() set
> send_win to true and trigger redundant window updates?
>
No, because of the previous patch that is mentioned as a precondition.
> If redundant updates are sent, could transient send buffer exhaustion cause
> the socket to unintentionally hit the error path below and disconnect?
I'm not sure I understand the question. But I think this works as designed.
next prev parent reply other threads:[~2026-08-24 12:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 11:17 [PATCH net v2 0/3] net/iucv: fix the recvmsg window update Bryam Vargas via B4 Relay
2026-08-21 11:17 ` Bryam Vargas
2026-08-21 11:17 ` [PATCH net v2 1/3] net/iucv: only send the window update on HiperSockets sockets Bryam Vargas via B4 Relay
2026-08-21 11:17 ` Bryam Vargas
2026-08-22 11:17 ` sashiko-bot
2026-08-28 10:05 ` Alexandra Winter
2026-08-21 11:17 ` [PATCH net v2 2/3] net/iucv: claim the receive credit atomically Bryam Vargas via B4 Relay
2026-08-21 11:17 ` Bryam Vargas
2026-08-22 11:17 ` sashiko-bot
2026-08-21 11:17 ` [PATCH net v2 3/3] net/iucv: send the window update outside message_q.lock Bryam Vargas via B4 Relay
2026-08-21 11:17 ` Bryam Vargas
2026-08-22 11:17 ` sashiko-bot
2026-08-24 12:58 ` Alexandra Winter [this message]
2026-08-24 13:08 ` [PATCH net v2 0/3] net/iucv: fix the recvmsg window update Alexandra Winter
2026-08-25 13:17 ` Aswin Karuvally
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=732e3384-34a6-4309-b3ae-a8f3eccc7dad@linux.ibm.com \
--to=wintera@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hexlabsecurity@proton.me \
--cc=linux-s390@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 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.