Netdev List
 help / color / mirror / Atom feed
From: Alexandra Winter <wintera@linux.ibm.com>
To: Breno Leitao <leitao@debian.org>,
	Thorsten Winkler <twinkler@linux.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Ursula Braun <ursula.braun@de.ibm.com>,
	Frank Blaschka <frank.blaschka@de.ibm.com>
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	Stanislav Fomichev <sdf.kernel@gmail.com>
Subject: Re: [PATCH net] net/iucv: fix locking in .getsockopt
Date: Fri, 22 May 2026 15:36:50 +0200	[thread overview]
Message-ID: <edd509f9-c64a-4802-bb5e-df06f638457e@linux.ibm.com> (raw)
In-Reply-To: <20260521-af_iucv_fix2-v1-1-f16b1c510aa9@debian.org>



On 21.05.26 16:11, Breno Leitao wrote:
> Mirror iucv_sock_setsockopt() and wrap the whole switch in
> lock_sock()/release_sock(). The pre-existing SO_MSGLIMIT-only lock
> becomes redundant and is removed.
> 
> Any AF_IUCV HIPER user can potentially crash the kernel by racing
> recvmsg() with getsockopt(SO_MSGSIZE): the SO_MSGSIZE arm dereferences
> iucv->hs_dev->mtu after iucv_sock_close() (called from the racing
> recvmsg()) has set hs_dev to NULL, producing a NULL pointer dereference
> oops.
> 
> Suggested-by: Stanislav Fomichev <sdf.kernel@gmail.com>
> Fixes: 51363b8751a6 ("af_iucv: allow retrieval of maximum message size")
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Note1: Not using goto/label to simplify the merge conflict that might
> happen with the migration of af_iucv to getsockopt_iter
> 
> Note2: This was only compile-tested.
> ---

Thank you very much Breno.

I ran some regression tests which call IUCV getsockopt(SO_MSGSIZE) while
sending and receiving data via IUCV. I have not created a specific
reproducer testcase of the described race, which would require enforcing
a problem in IUCV over HS congestion management which triggers an error
path in recvmsg().

Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Tested-by: Alexandra Winter <wintera@linux.ibm.com>


  reply	other threads:[~2026-05-22 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 14:11 [PATCH net] net/iucv: fix locking in .getsockopt Breno Leitao
2026-05-22 13:36 ` Alexandra Winter [this message]
2026-05-23  0:50 ` patchwork-bot+netdevbpf

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=edd509f9-c64a-4802-bb5e-df06f638457e@linux.ibm.com \
    --to=wintera@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=frank.blaschka@de.ibm.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf.kernel@gmail.com \
    --cc=twinkler@linux.ibm.com \
    --cc=ursula.braun@de.ibm.com \
    /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