From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 900E13033E7; Mon, 17 Aug 2026 14:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975451; cv=none; b=W2G3fzdHtNUMuwUgEAZ0nKRzjTJVywwe8rtw/UXDMhlytmnWBTLfWLc+snEEr4DffgrJBcSehO5XidiZnwjPeFkGAI3PGh8qD2/W4RUK894vTSjK3D6FawFAvoTbbx3klFYRpbe23iZKTSyXG3bPihCdHxI7ol4Q6wbr8hBS5D0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786975451; c=relaxed/simple; bh=90QqnERAdzJBK0iP0o9bvnsF1jvmukd9jaJtF//M0Tg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LcDNHpySdD6Ns01e/jpX2ukwy8QS2LFdZ6y+XFjO96cRGRBIpaKU2uOjjEV9QaGiRPCXfmZeU12pZArOgwzbJexJBgVuRW/N2qb2UQL47FV0iXepFxsoYw/JTt8vnL27BiAfG/rYjMXhmyG+52AciwMUjF6JS4+kOy/yHxBdQ0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CNV40ydY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CNV40ydY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8D981F000E9; Mon, 17 Aug 2026 14:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786975450; bh=zz+ZGtxLDas92xLouHfdmhdwLoK98hpg+vGWFAR9Jys=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CNV40ydYStU0xqGX4VU8NXjVk7fpEHrttyb4afuS8g5fiOQi2cbh+Wz4rodI3WGJ2 7OOAUQlbWfdqPHTXQ5cfiWDElyoWZ5+AexCOzBRgYcXsrqsy4iRjbM2/TjOf7yRAgG 5iscrMk7QkD6CFaHdcTMvvGdBNLu9l2GEaZsqsfQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Hidayath Khan , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 033/389] net/iucv: take a reference on the socket found in afiucv_hs_rcv() Date: Mon, 17 Aug 2026 15:27:52 +0200 Message-ID: <20260817132540.259516523@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132538.796021292@linuxfoundation.org> References: <20260817132538.796021292@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas [ Upstream commit 4fa349156043dc119721d067329714179f501749 ] afiucv_hs_rcv() looks up the destination socket under iucv_sk_list.lock, drops the lock, and then passes the socket to the afiucv_hs_callback_*() handlers without holding a reference. AF_IUCV sockets are not RCU-protected and are freed synchronously by iucv_sock_kill() -> sock_put(), so a concurrent close can free the socket in the window between read_unlock() and the handler, which then dereferences freed memory (for example sk->sk_data_ready() in afiucv_hs_callback_syn()). Take a reference with sock_hold() while the socket is still on the list and release it with sock_put() once the handler has run. Fixes: 3881ac441f64 ("af_iucv: add HiperSockets transport") Signed-off-by: Bryam Vargas Reviewed-by: Hidayath Khan Link: https://patch.msgid.link/20260705-b4-disp-fc79c0dc-v1-1-d2cdcb57afa9@proton.me Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/iucv/af_iucv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 8c08f07ce46551..3fb93840ec91bb 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -2083,6 +2083,8 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, } } } + if (sk) + sock_hold(sk); read_unlock(&iucv_sk_list.lock); if (!iucv) sk = NULL; @@ -2132,6 +2134,8 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, kfree_skb(skb); } + if (sk) + sock_put(sk); return err; } -- 2.53.0