Messages in this thread Patch in this message | | | From | JiangJianJun <> | Subject | [PATCH] scsi: sr: fix signed integer overflow | Date | Mon, 18 Dec 2023 17:50:54 +0800 |
| |
Checking the range of the parameter speed, avoid integer overflow.
Signed-off-by: JiangJianJun <jiangjianjun3@huawei.com> --- drivers/scsi/sr_ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 5b0b35e60e61..d5b2cd80d171 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -430,6 +430,8 @@ int sr_select_speed(struct cdrom_device_info *cdi, int speed) Scsi_CD *cd = cdi->handle; struct packet_command cgc; + if (speed < 0 || speed > (INT_MAX / 177)) + return -EINVAL; if (speed == 0) speed = 0xffff; /* set to max */ else -- 2.39.3
| |