From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386969; b=iuU8PjB6T2bxBGaECgcru5NjL8Ye8CO+BjwRb39lWyaHwAcRqjHWb7B7Fl6IsSzi5Y/b ZpKlGCjLsgZZ10ogK/4r5pefrJs0CciRiTZ7tOGnWonXSDyNf6y06krzy4qqFBFHmhM6j IWJeqmbhL9jFAPdxeNh2V9IwaKP8nAxl5V7nq/eEb82dYKgWH3TW/RS75Wzz3WUraj5rv 2FdHk+WTP5db60jl40Od/oVBjPfJ2T1OZiiomZROvMPpAJoevuHTBY/0Mk/j2TYbMr7LJ 8vFygxvA38ub4xmQgl8MbVb1QhBYBO9UIe8xKiBLDFxOzluEurGotKZDFeR0oxPafsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386969; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=aheyt4Mhe4f1hb6yA3oCrwTbA1JgvBHhv8NCCzxEZYg=; b=OiCrb4tat3bDk2QTWXFCND+uVagGpI239FeIuLf+dPkUWNSh9Ufh5+n4b1o31jE490wU bYaP7jM1qJQp3NdUWrzSdfcgoRwKLw3fyq73t8g+Xn1om1yF+gVmWBjJNrODEyfKvRcA/ 5ZJb+EFfJeUJ7nmZo5zU+tRuC3OeNDovuckLSuu5CXchyau45MS+x11eocrWn8vVtH/lM Q8gToTreEXnCuJB8R73jzCLrYzeUjdCs1CpVR4OPn497TpbmLgSlgrMimGtjnwxVi3Tt0 tvl/veO7mgfOXZtNrRrMZDXnYs793UKE9HX3cazgN/PCGCVLWkBbL39mhCtITTPKh8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nh9KCwSq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A7E5606A32D; Fri, 4 Dec 2026 12:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=nh9KCwSq Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5EFD1F000C2; Fri, 4 Dec 2026 12:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386969; bh=aheyt4Mhe4f1hb6yA3oCrwTbA1JgvBHhv8NCCzxEZYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nh9KCwSqE20JdEQ+hyNbz6EPEf//BaLieL5osV0ygLAh+j6eu83+JlYWaaahqE99r 7bZlRhCAbJ1DTVxdBOlco5sqr+ljHxHEEvVEnQM6QmF8VT285uqxk2nn6D2tUldtbl /iwNTKx5RSRKetVEw56FW+98LOyuKAOdIkonWYgE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Simon Horman , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 0079/1059] net/iucv: take a private, writable frame before rewriting it in place Date: Fri, 4 Dec 2026 18:53:30 +0900 Message-ID: <20261204100646.153086062@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas [ Upstream commit f38bce9af9e2a3cced7d303a1476f21c1f42bcb7 ] afiucv_hs_rcv() rewrites the frame in place -- EBCASC() on four name fields, then afiucv_swap_src_dest() swaps them and pushes an Ethernet header -- and can hand the same skb to dev_queue_xmit(), without making it private first, so a packet socket that also gets the frame reads the rewritten names. An ETH_P_ALL tap runs first and leaves af_iucv a cloned skb; a socket opened for ETH_P_AF_IUCV sits on a ptype_specific list, walked after ptype_base[], so deliver_skb() takes a reference and af_iucv runs on an skb that is shared but not cloned. Unshare, then cow, in that order: skb_cow() can reach pskb_expand_head(), which has BUG_ON(skb_shared()). skb_cow() tests skb_cloned(), which is what a rewrite of the data needs; skb_cow_head() tests only the header. Asking for ETH_HLEN also covers the unchecked push in afiucv_swap_src_dest(); on the ordinary path eth_type_trans() has already pulled that much, so it only compares. Fixes: 3881ac441f64 ("af_iucv: add HiperSockets transport") Closes: https://sashiko.dev/#/patchset/20260813-b4-disp-60433a46-v1-1-509e1200533e@proton.me?part=1 Signed-off-by: Bryam Vargas Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261028-b4-disp-1edbbc34-v3-1-13495411f5b9@proton.me Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/iucv/af_iucv.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index c56bf6d96ac01..ae459478c1eca 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -2073,11 +2073,20 @@ static int afiucv_hs_rcv(struct sk_buff *skb, struct net_device *dev, int err = NET_RX_SUCCESS; char nullstring[8]; + skb = skb_share_check(skb, GFP_ATOMIC); + if (!skb) + return NET_RX_SUCCESS; + if (!pskb_may_pull(skb, sizeof(*trans_hdr))) { kfree_skb(skb); return NET_RX_SUCCESS; } + if (skb_cow(skb, ETH_HLEN)) { + kfree_skb(skb); + return NET_RX_SUCCESS; + } + trans_hdr = iucv_trans_hdr(skb); EBCASC(trans_hdr->destAppName, sizeof(trans_hdr->destAppName)); EBCASC(trans_hdr->destUserID, sizeof(trans_hdr->destUserID)); -- 2.53.0