Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Nagamani PV <nagamani@linux.ibm.com>
To: wintera@linux.ibm.com, aswin@linux.ibm.com,
	sidraya@linux.ibm.com, hidayath@linux.ibm.com,
	pasic@linux.ibm.com, mjambigi@linux.ibm.com, dk@linux.ibm.com,
	twinkler@linux.ibm.com, jaka@linux.ibm.com, wenjia@linux.ibm.com,
	gbayer@linux.ibm.com,
	linux390-list@tuxmaker.boeblingen.de.ibm.com
Cc: Nagamani PV <nagamani@linux.ibm.com>,
	stable@vger.kernel.org,
	syzbotz+89435e7383b82238dd91@linux.ibm.com
Subject: [PATCH net-next V2] net/iucv: fix UAF in afiucv_netdev_event()
Date: Fri,  8 May 2026 19:05:34 +0200	[thread overview]
Message-ID: <20260508170534.2208812-1-nagamani@linux.ibm.com> (raw)

afiucv_netdev_event() traverses iucv_sk_list without holding
iucv_sk_list.lock.

A concurrent socket teardown can unlink and free the socket via
iucv_sock_kill() while the notifier path is still iterating over
the list, leading to a possible use-after-free when dereferencing
the socket.

Protect the traversal using the existing read-side lock, matching
the locking pattern already used by other iucv_sk_list traversal
paths in af_iucv.c.

Use read_lock()/read_unlock() to remain consistent with existing
softirq/tasklet-side readers in the same file.

Fixes: 9fbd87d41392 ("af_iucv: handle netdev events")
Cc: stable@vger.kernel.org
Reported-by: syzbotz+89435e7383b82238dd91@linux.ibm.com
Closes: https://lnxgwne1.boeblingen.de.ibm.com/linux-ci/syzbot/dashboard/bug?extid=89435e7383b82238dd91
Suggested-by: Hidayath Khan <hidayath@linux.ibm.com>
Signed-off-by: Nagamani PV <nagamani@linux.ibm.com>

---
v2:
- Target net-next (missed in v1 subject)
---
 net/iucv/af_iucv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 72dfccd4e3d5..e8a0b55fc55d 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -2188,6 +2188,7 @@ static int afiucv_netdev_event(struct notifier_block *this,
 	switch (event) {
 	case NETDEV_REBOOT:
 	case NETDEV_GOING_DOWN:
+		read_lock(&iucv_sk_list.lock);
 		sk_for_each(sk, &iucv_sk_list.head) {
 			iucv = iucv_sk(sk);
 			if ((iucv->hs_dev == event_dev) &&
@@ -2198,6 +2199,7 @@ static int afiucv_netdev_event(struct notifier_block *this,
 				sk->sk_state_change(sk);
 			}
 		}
+		read_unlock(&iucv_sk_list.lock);
 		break;
 	case NETDEV_DOWN:
 	case NETDEV_UNREGISTER:
-- 
2.53.0


             reply	other threads:[~2026-05-08 17:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 17:05 Nagamani PV [this message]
2026-05-11  9:11 ` [PATCH net-next V2] net/iucv: fix UAF in afiucv_netdev_event() Alexandra Winter
2026-05-11  9:14   ` Alexandra Winter
2026-05-11 10:09     ` Greg KH
2026-05-11 13:38   ` Nagamani PV
2026-05-13  8:29     ` Alexandra Winter
2026-05-11 14:04 ` Steffen Maier

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=20260508170534.2208812-1-nagamani@linux.ibm.com \
    --to=nagamani@linux.ibm.com \
    --cc=aswin@linux.ibm.com \
    --cc=dk@linux.ibm.com \
    --cc=gbayer@linux.ibm.com \
    --cc=hidayath@linux.ibm.com \
    --cc=jaka@linux.ibm.com \
    --cc=linux390-list@tuxmaker.boeblingen.de.ibm.com \
    --cc=mjambigi@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=sidraya@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbotz+89435e7383b82238dd91@linux.ibm.com \
    --cc=twinkler@linux.ibm.com \
    --cc=wenjia@linux.ibm.com \
    --cc=wintera@linux.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