]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ipmi: ssif_bmc: prevent integer overflow on 32bit systems
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 14 Jun 2024 17:30:44 +0000 (20:30 +0300)
committerCorey Minyard <corey@minyard.net>
Fri, 14 Jun 2024 18:51:36 +0000 (13:51 -0500)
commit0627cef36145c9ff9845bdfd7ddf485bbac1f981
tree8d66c84ea5bdcd21206e073797ee8e143b4538b7
parent0cac73eb3875f6ecb6105e533218dba1868d04c9
ipmi: ssif_bmc: prevent integer overflow on 32bit systems

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@linaro.org>
Message-Id: <1431ca2e-4e9c-4520-bfc0-6879313c30e9@moroto.mountain>
Signed-off-by: Corey Minyard <corey@minyard.net>
drivers/char/ipmi/ssif_bmc.c