Patch "ipmi: ssif_bmc: prevent integer overflow on 32bit systems" has been added to the 6.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

    ipmi: ssif_bmc: prevent integer overflow on 32bit systems

to the 6.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:
     ipmi-ssif_bmc-prevent-integer-overflow-on-32bit-syst.patch
and it can be found in the queue-6.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 033ce8a77f7e3b53b3a132eed8694f2f37f474b2
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Fri Jun 14 20:30:44 2024 +0300

    ipmi: ssif_bmc: prevent integer overflow on 32bit systems
    
    [ Upstream commit 0627cef36145c9ff9845bdfd7ddf485bbac1f981 ]
    
    There are actually two bugs here.  First, we need to ensure that count
    is at least sizeof(u32) or msg.len will be uninitialized data.
    
    The "msg.len" variable is a u32 that comes from the user.  On 32bit
    systems the "sizeof_field(struct ipmi_ssif_msg, len) + msg.len"
    addition can overflow if "msg.len" is greater than U32_MAX - 4.
    
    Valid lengths for "msg.len" are 1-254.  Add a check for that to
    prevent the integer overflow.
    
    Fixes: dd2bc5cc9e25 ("ipmi: ssif_bmc: Add SSIF BMC driver")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Message-Id: <1431ca2e-4e9c-4520-bfc0-6879313c30e9@moroto.mountain>
    Signed-off-by: Corey Minyard <corey@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
index 56346fb328727..ab4e87a99f087 100644
--- a/drivers/char/ipmi/ssif_bmc.c
+++ b/drivers/char/ipmi/ssif_bmc.c
@@ -177,13 +177,15 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
 	unsigned long flags;
 	ssize_t ret;
 
-	if (count > sizeof(struct ipmi_ssif_msg))
+	if (count < sizeof(msg.len) ||
+	    count > sizeof(struct ipmi_ssif_msg))
 		return -EINVAL;
 
 	if (copy_from_user(&msg, buf, count))
 		return -EFAULT;
 
-	if (!msg.len || count < sizeof_field(struct ipmi_ssif_msg, len) + msg.len)
+	if (!msg.len || msg.len > IPMI_SSIF_PAYLOAD_MAX ||
+	    count < sizeof_field(struct ipmi_ssif_msg, len) + msg.len)
 		return -EINVAL;
 
 	spin_lock_irqsave(&ssif_bmc->lock, flags);




[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