Patch "net: skip virtio_net_hdr_set_proto if protocol already set" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: skip virtio_net_hdr_set_proto if protocol already set

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-skip-virtio_net_hdr_set_proto-if-protocol-alread.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2c0bdb17dca4f54825a4037a2d722c088755ebee
Author: Willem de Bruijn <willemb@xxxxxxxxxx>
Date:   Mon Dec 20 09:50:27 2021 -0500

    net: skip virtio_net_hdr_set_proto if protocol already set
    
    [ Upstream commit 1ed1d592113959f00cc552c3b9f47ca2d157768f ]
    
    virtio_net_hdr_set_proto infers skb->protocol from the virtio_net_hdr
    gso_type, to avoid packets getting dropped for lack of a proto type.
    
    Its protocol choice is a guess, especially in the case of UFO, where
    the single VIRTIO_NET_HDR_GSO_UDP label covers both UFOv4 and UFOv6.
    
    Skip this best effort if the field is already initialized. Whether
    explicitly from userspace, or implicitly based on an earlier call to
    dev_parse_header_protocol (which is more robust, but was introduced
    after this patch).
    
    Fixes: 9d2f67e43b73 ("net/packet: fix packet drop as of virtio gso")
    Signed-off-by: Willem de Bruijn <willemb@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211220145027.2784293-1-willemdebruijn.kernel@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 22dd48c825600..a960de68ac69e 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -25,6 +25,9 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type)
 static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
 					   const struct virtio_net_hdr *hdr)
 {
+	if (skb->protocol)
+		return 0;
+
 	switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
 	case VIRTIO_NET_HDR_GSO_TCPV4:
 	case VIRTIO_NET_HDR_GSO_UDP:



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux