Patch "net: usb: sr9700: Handle negative len" has been added to the 5.10-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: usb: sr9700: Handle negative len

to the 5.10-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-usb-sr9700-handle-negative-len.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 8f8332ec8383f5273bed0f435b57a4c44e7a98c7
Author: Szymon Heidrich <szymon.heidrich@xxxxxxxxx>
Date:   Sat Jan 14 19:23:26 2023 +0100

    net: usb: sr9700: Handle negative len
    
    [ Upstream commit ecf7cf8efb59789e2b21d2f9ab926142579092b2 ]
    
    Packet len computed as difference of length word extracted from
    skb data and four may result in a negative value. In such case
    processing of the buffer should be interrupted rather than
    setting sr_skb->len to an unexpectedly large value (due to cast
    from signed to unsigned integer) and passing sr_skb to
    usbnet_skb_return.
    
    Fixes: e9da0b56fe27 ("sr9700: sanity check for packet length")
    Signed-off-by: Szymon Heidrich <szymon.heidrich@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230114182326.30479-1-szymon.heidrich@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index fce6713e970b..811c8751308c 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 		/* ignore the CRC length */
 		len = (skb->data[1] | (skb->data[2] << 8)) - 4;
 
-		if (len > ETH_FRAME_LEN || len > skb->len)
+		if (len > ETH_FRAME_LEN || len > skb->len || len < 0)
 			return 0;
 
 		/* the last packet of current skb */



[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