[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231218095054.12228-1-jiangjianjun3@huawei.com>
Date: Mon, 18 Dec 2023 17:50:54 +0800
From: JiangJianJun <jiangjianjun3@...wei.com>
To: <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<louhongxiang@...wei.com>, <haowenchao2@...wei.com>, <lixiaokeng@...wei.com>
Subject: [PATCH] scsi: sr: fix signed integer overflow
Checking the range of the parameter speed, avoid integer overflow.
Signed-off-by: JiangJianJun <jiangjianjun3@...wei.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
Powered by blists - more mailing lists