From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 054701CCB42; Mon, 14 Oct 2024 14:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917634; cv=none; b=OYNtm6b0a9uJtVrp8hgmhW3nlEhsnAbIaFDvSRKSM3YXBeriI2YUPATDomfz/m433rKvzqAoywqq/MIIUtf7+sP0xCFxKh57vQhhMIhTeAuAO7wqpOb6Pcm5CqPXVx+UxG4HvGTwpQdSMuU2e+2IqxeyVmOG7CLL7wZsYcx1i4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917634; c=relaxed/simple; bh=vr265cPA5XHjERuVSmbInkoGonICWPHPHHzDV0Rqpe4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MGmgUlCzUkoWcWe5BDWbpo/vYVnf2Qw2bRqk0wLpn/KILtjiOgIxm9rexhw1xVVZbuKBECDsg57F5520XrRKOyL2sKco6EibUWVgMUciIXOv5OaZID30GQ/XucvyCLZTHO/mTKAS6svPZieEcOr73b76QYZgNBFBdjX69vZQTZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ET1YXIlE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ET1YXIlE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE81C4CEC3; Mon, 14 Oct 2024 14:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728917633; bh=vr265cPA5XHjERuVSmbInkoGonICWPHPHHzDV0Rqpe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ET1YXIlE3HrTRCeZXTcyyFVMbaOYE4xrqaR83Ym1wNsxxbPYYUpKalRVZjvhHz6d5 XnejT3pFiWb1wW9910+b6Rc28Qhh2xHNKIU245fNc4hh4Uv+PF14x3KZSvFi20jIUY D4MogaKD8TuHY97DujMSeUgCLfKMOdjg5drtJlkU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Guillaume Nault , Willem de Bruijn , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 056/798] bareudp: Pull inner IP header on xmit. Date: Mon, 14 Oct 2024 16:10:10 +0200 Message-ID: <20241014141220.144632130@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guillaume Nault [ Upstream commit c471236b2359e6b27388475dd04fff0a5e2bf922 ] Both bareudp_xmit_skb() and bareudp6_xmit_skb() read their skb's inner IP header to get its ECN value (with ip_tunnel_ecn_encap()). Therefore we need to ensure that the inner IP header is part of the skb's linear data. Fixes: 571912c69f0e ("net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.") Signed-off-by: Guillaume Nault Reviewed-by: Willem de Bruijn Link: https://patch.msgid.link/267328222f0a11519c6de04c640a4f87a38ea9ed.1726046181.git.gnault@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/bareudp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index d0759d8bf7305..54767154de265 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -319,6 +319,9 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be32 saddr; int err; + if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB))) + return -EINVAL; + if (!sock) return -ESHUTDOWN; @@ -382,6 +385,9 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev, __be16 sport; int err; + if (!skb_vlan_inet_prepare(skb, skb->protocol != htons(ETH_P_TEB))) + return -EINVAL; + if (!sock) return -ESHUTDOWN; -- 2.43.0