Patch "net: check dev->gso_max_size in gso_features_check()" has been added to the 5.4-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: check dev->gso_max_size in gso_features_check()

to the 5.4-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-check-dev-gso_max_size-in-gso_features_check.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 2b652764a8c604a8ec813d764f1d1e99b2c0ac4b
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Tue Dec 19 12:53:31 2023 +0000

    net: check dev->gso_max_size in gso_features_check()
    
    [ Upstream commit 24ab059d2ebd62fdccc43794796f6ffbabe49ebc ]
    
    Some drivers might misbehave if TSO packets get too big.
    
    GVE for instance uses a 16bit field in its TX descriptor,
    and will do bad things if a packet is bigger than 2^16 bytes.
    
    Linux TCP stack honors dev->gso_max_size, but there are
    other ways for too big packets to reach an ndo_start_xmit()
    handler : virtio_net, af_packet, GRO...
    
    Add a generic check in gso_features_check() and fallback
    to GSO when needed.
    
    gso_max_size was added in the blamed commit.
    
    Fixes: 82cc1a7a5687 ("[NET]: Add per-connection option to set max TSO frame size")
    Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231219125331.4127498-1-edumazet@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/dev.c b/net/core/dev.c
index 9845dcf0a3ded..5e043e6f09476 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3140,6 +3140,9 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb,
 	if (gso_segs > dev->gso_max_segs)
 		return features & ~NETIF_F_GSO_MASK;
 
+	if (unlikely(skb->len >= READ_ONCE(dev->gso_max_size)))
+		return features & ~NETIF_F_GSO_MASK;
+
 	if (!skb_shinfo(skb)->gso_type) {
 		skb_warn_bad_offload(skb);
 		return features & ~NETIF_F_GSO_MASK;




[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