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=1795617574; b=XeICBcrxWTnbwPAyRBXeKj2XBCaRWXKMbbekJjdIVmjk+Cv7CSJPUmFYVEY/jWLrBdsg yNr/HD8sgMKoqM2xdfz6fRlgT+HHk7Zg1lxGfz7kuztX8UUsChjlMQLr94FqEu+/PwpR8 yIMFH5yCNHngbAy5KP1Q0EUj3zjB7GejmM/gQtgbchg/7HkmDIQgzJJQHzaxrVSUaAL4+ P+slSQj09kH31IBlzi8fJrYil/M50qaEJACaUPBdxOJzRxqZfCyX/B8hSrQQ0SG3RkCll 1PtAC2bjhK2c86d121vSJL0MrWb1ccQKSZDU58zCOtaP5cE9Z02JuKklQr3vCxaYiwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617574; 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=YGL8AAM+Rywzpq9uB50ZUd7o5Q5t6RYYQmAYETE2/9M=; b=xvMo5IFFoANpiXg2OwENMxs8HMAVqHuitOUjoRurzDd4ngBzUOiDH+uvon+Skt2ONgsQ 4O7P+X8rdxxNg7N1J+Wjf6YqmWf8GhFLflJSRE6T31krdtBnq5Ymq+HELZKTRFIGOsg3z 7YYBf6vcFODTBkool3yIJZW7NSPWEZUaZ/DiRpiUkahLauNS2Y1Naz80ZjaWx6z5rET3I rEAxRYC8/ZYdYhpZGyLAetngrO+dNhS45SaS3PXoDJhFECTi0gwKN4AGsYRxuECzWopqt k7KVwPrLyNMpmi7k90y9dqHGpGJ7wPJTXHlLwSnyjgSQv+yKfc9HkGAcjFpnPxUZZZA== 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=AJensEkC; 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 96632606A31E; Wed, 25 Nov 2026 14:39:34 +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=AJensEkC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 586271F000EC; Wed, 25 Nov 2026 14:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795617573; bh=YGL8AAM+Rywzpq9uB50ZUd7o5Q5t6RYYQmAYETE2/9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AJensEkCbIj3wzWtLGlBeNkqB0uvwX+DMuAEyfAtvyh0xj3/U0vN5iLrS7V37Pjjo BlpHrDswRZtPgJgsPTVK/kozqO+E6ODjt8SQ+3uO1uaUVefx17gcDXlgOzv5z0sRMW EtDFb4telarRbee/t3M5WebDCSKtXHEJeSL/e2iM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Willem de Bruijn , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.3 0001/1005] tun: clear stale skb->protocol of NAPI frags skbs Date: Wed, 25 Nov 2026 15:22:19 +0100 Message-ID: <20261125143821.771647658@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 3287cd714a853d9443c4a743eca010aedcfbbcdd ] With IFF_NAPI_FRAGS, tun_napi_alloc_frags() gets its skb from napi_get_frags(). If GRO merged the previous frame with GRO_MERGED_FREE, that skb was recycled by napi_reuse_skb(), which does not reset skb->protocol set by napi_frags_skb() for the previous frame. tun_get_user() calls tun_vnet_hdr_tnl_to_skb() before eth_type_trans(), so the virtio header checks see the protocol of the previous frame: GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are dissected with the wrong protocol. A following change checks the outer protocol of UDP tunnel GSO packets, which would then reject a valid frame when the two ethertypes differ. This needs GRO to hold packets across writes, and IFF_NAPI_FRAGS needs CAP_NET_ADMIN. Clear skb->protocol in tun_napi_alloc_frags(), like skbs allocated by tun_alloc_skb() or build_skb(). eth_type_trans() sets it later. Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver") Reported-by: Sashiko Closes: https://lore.kernel.org/netdev/179386753589.488856.11455181721004759454@kernel.org/ Suggested-by: Willem de Bruijn Reviewed-by: Willem de Bruijn Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20261110213628.3476051-3-edumazet@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/tun.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 2ed348b953159..8a5ffd6904891 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1500,6 +1500,12 @@ static struct sk_buff *tun_napi_alloc_frags(struct tun_file *tfile, if (!skb) return ERR_PTR(-ENOMEM); + /* An skb recycled by napi_reuse_skb() keeps the protocol of a + * previous frame. eth_type_trans() sets it after the virtio + * header checks, which must not see a stale one. + */ + skb->protocol = 0; + linear = iov_iter_single_seg_count(it); err = __skb_grow(skb, linear); if (err) -- 2.53.0