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 A94A7208BD for ; Mon, 6 Nov 2023 13:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UVkAZtCM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26EFFC433C7; Mon, 6 Nov 2023 13:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699276168; bh=TLYh+IxqQB+jfdWx7Mt84V8BvfteDkXrdBSv7c87xAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UVkAZtCMrftjQNHmeevMr5sWvpV+9vGmT+oXjS08kU5O9Gjlzavc/G9mjh1B/19AG mh7k4gwzjo48cOHe7IFeVnK9t/cpTSa23BtiXLMfPp+tNfiDe38kf8hu1k0rmoVcsU AaMJ4RVeiyZRGtSyUneDiaxuGQ1C6KzQX9Ooi15I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso , Paolo Abeni Subject: [PATCH 4.19 13/61] gtp: fix fragmentation needed check with gso Date: Mon, 6 Nov 2023 14:03:09 +0100 Message-ID: <20231106130300.033972803@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231106130259.573843228@linuxfoundation.org> References: <20231106130259.573843228@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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pablo Neira Ayuso commit 4530e5b8e2dad63dcad2206232dd86e4b1489b6c upstream. Call skb_gso_validate_network_len() to check if packet is over PMTU. Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- drivers/net/gtp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -548,8 +548,9 @@ static int gtp_build_skb_ip4(struct sk_b rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu, false); - if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && - mtu < ntohs(iph->tot_len)) { + if (iph->frag_off & htons(IP_DF) && + ((!skb_is_gso(skb) && skb->len > mtu) || + (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)))) { netdev_dbg(dev, "packet too big, fragmentation needed\n"); icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));