Patch "usb: rndis_host: Secure rndis_query check against int overflow" has been added to the 4.19-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

    usb: rndis_host: Secure rndis_query check against int overflow

to the 4.19-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:
     usb-rndis_host-secure-rndis_query-check-against-int-.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 222ef43d7b1aa8025766444d3cdefd14761c0a87
Author: Szymon Heidrich <szymon.heidrich@xxxxxxxxx>
Date:   Tue Jan 3 10:17:09 2023 +0100

    usb: rndis_host: Secure rndis_query check against int overflow
    
    [ Upstream commit c7dd13805f8b8fc1ce3b6d40f6aff47e66b72ad2 ]
    
    Variables off and len typed as uint32 in rndis_query function
    are controlled by incoming RNDIS response message thus their
    value may be manipulated. Setting off to a unexpectetly large
    value will cause the sum with len and 8 to overflow and pass
    the implemented validation step. Consequently the response
    pointer will be referring to a location past the expected
    buffer boundaries allowing information leakage e.g. via
    RNDIS_OID_802_3_PERMANENT_ADDRESS OID.
    
    Fixes: ddda08624013 ("USB: rndis_host, various cleanups")
    Signed-off-by: Szymon Heidrich <szymon.heidrich@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index ab41a63aa4aa..497d6bcdc276 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -267,7 +267,8 @@ static int rndis_query(struct usbnet *dev, struct usb_interface *intf,
 
 	off = le32_to_cpu(u.get_c->offset);
 	len = le32_to_cpu(u.get_c->len);
-	if (unlikely((8 + off + len) > CONTROL_BUFFER_SIZE))
+	if (unlikely((off > CONTROL_BUFFER_SIZE - 8) ||
+		     (len > CONTROL_BUFFER_SIZE - 8 - off)))
 		goto response_error;
 
 	if (*reply_len != -1 && len != *reply_len)



[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