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 1525523A99F; Thu, 30 Jul 2026 15:37:38 +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=1785425859; cv=none; b=G202rmejDjvNqiVXccMYp3n6qr1FYbJh1jPgE36LSmvAVhJe9R2tg4DaOQBLzJ6bgxzn1troYLvmTaaHWGF/Dwq1f5/A2YENKGdMBDsnKHZ/O1pJgB9vkmi8zx8lF474shz1wGo4JSJGoTsbATecIumUeRH0Aaj0OXYkf48jDVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785425859; c=relaxed/simple; bh=Zh6hKXmSTRH5OFMI06a5crzYxgtjQ3HVDfJpYjd2/MY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mXlB8vLikysWflPG+9Qz32OcvcUHURtAQ5jVdfmjVEiX3nIsR7tUAPgBjO+pevqt5NYEOtniGylNWp/ulpF5sda3NHXQhHB8/iQYlkhhlZ9WYqE1+ZvyOXT1DNVnCHtx+Eh+Q3nqZYoseoD8jzSetknSwq7/oLM42NKGEZF9tjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kmdu0wzS; 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="kmdu0wzS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 714251F000E9; Thu, 30 Jul 2026 15:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785425858; bh=pA3BboNy8JGsveS/YAxOaeEhi1S/NC3qydpStuq4a88=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kmdu0wzSch+XAiClSQlgVObOhDaRBQCuH9N5upr4N1YJLxIWqoABVADXK+yMokuep MPKYPHROtO+RNvc5V/8EOtf0O7nnPT92n3vf+nBiUBxP3DmA9OUxQ2ekIYEfoSHnKD vivRDLWNG6g44FwY40ZM9ZwiPMGqpo1lZ2id8aHk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Bommarito , Simon Horman , Taehee Yoo , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 215/602] amt: make the head writable before rewriting the L2 header Date: Thu, 30 Jul 2026 16:10:07 +0200 Message-ID: <20260730141440.474279705@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Bommarito [ Upstream commit 53969d704fa5b7c1751e277fac96bfc22b435eac ] amt_multicast_data_handler(), amt_membership_query_handler() and amt_update_handler() rewrite the ethernet header of the decapsulated skb in place (eth->h_proto, eth->h_dest and, for the query, also eth->h_source) before handing it up the stack. The skb head may be shared, for example when a packet tap has cloned it on the underlay interface, so writing through it corrupts the other reader's copy. Call skb_cow_head() before the rewrite so the head is private. It is placed before the pointers into the head are (re-)derived, so a reallocation caused by the copy is picked up by those derivations. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Michael Bommarito Reviewed-by: Simon Horman Reviewed-by: Taehee Yoo Link: https://patch.msgid.link/20260711151934.2955226-3-michael.bommarito@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/amt.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 062798fb8aa655..77d6c443d81bf6 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -2315,6 +2315,9 @@ static bool amt_multicast_data_handler(struct amt_dev *amt, struct sk_buff *skb) skb_reset_mac_header(skb); skb_pull(skb, sizeof(*eth)); + if (skb_cow_head(skb, 0)) + return true; + if (!pskb_may_pull(skb, sizeof(*iph))) return true; iph = ip_hdr(skb); @@ -2391,6 +2394,8 @@ static bool amt_membership_query_handler(struct amt_dev *amt, skb_reset_network_header(skb); eth = eth_hdr(skb); ether_addr_copy(h_source, oeth->h_source); + if (skb_cow_head(skb, 0)) + return true; if (!pskb_may_pull(skb, sizeof(*iph))) return true; @@ -2516,6 +2521,9 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb) if (!pskb_may_pull(skb, sizeof(*iph))) return true; + if (skb_cow_head(skb, 0)) + return true; + iph = ip_hdr(skb); if (iph->version == 4) { if (ip_mc_check_igmp(skb)) { -- 2.53.0