Patch "cifs: fix underflow in parse_server_interfaces()" has been added to the 6.7-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

    cifs: fix underflow in parse_server_interfaces()

to the 6.7-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:
     cifs-fix-underflow-in-parse_server_interfaces.patch
and it can be found in the queue-6.7 subdirectory.

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



commit 1364f0465f2c7ab1b3c9ee15cfa5e2724735125f
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Thu Feb 8 13:18:46 2024 +0300

    cifs: fix underflow in parse_server_interfaces()
    
    [ Upstream commit cffe487026be13eaf37ea28b783d9638ab147204 ]
    
    In this loop, we step through the buffer and after each item we check
    if the size_left is greater than the minimum size we need.  However,
    the problem is that "bytes_left" is type ssize_t while sizeof() is type
    size_t.  That means that because of type promotion, the comparison is
    done as an unsigned and if we have negative bytes left the loop
    continues instead of ending.
    
    Fixes: fe856be475f7 ("CIFS: parse and store info on iface queries")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Reviewed-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
    Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index beb81fa00cff..ba734395b036 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -619,7 +619,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
 		goto out;
 	}
 
-	while (bytes_left >= sizeof(*p)) {
+	while (bytes_left >= (ssize_t)sizeof(*p)) {
 		memset(&tmp_iface, 0, sizeof(tmp_iface));
 		tmp_iface.speed = le64_to_cpu(p->LinkSpeed);
 		tmp_iface.rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;




[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