John Garry
37c72a6301
scsi: scsi_debug: Add check for sdebug_max_queue during module init
...
[ Upstream commit c87bf24cfb60bce27b4d2c7e56ebfd86fb9d16bb ]
sdebug_max_queue should not exceed SDEBUG_CANQUEUE, otherwise crashes like
this can be triggered by passing an out-of-range value:
Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019
pstate: 20400009 (nzCv daif +PAN -UAO BTYPE=--)
pc : schedule_resp+0x2a4/0xa70 [scsi_debug]
lr : schedule_resp+0x52c/0xa70 [scsi_debug]
sp : ffff800022ab36f0
x29: ffff800022ab36f0 x28: ffff0023a935a610
x27: ffff800008e0a648 x26: 0000000000000003
x25: ffff0023e84f3200 x24: 00000000003d0900
x23: 0000000000000000 x22: 0000000000000000
x21: ffff0023be60a320 x20: ffff0023be60b538
x19: ffff800008e13000 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: 0000000000000000
x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000
x9 : 0000000000000001 x8 : 0000000000000000
x7 : 0000000000000000 x6 : 00000000000000c1
x5 : 0000020000200000 x4 : dead0000000000ff
x3 : 0000000000000200 x2 : 0000000000000200
x1 : ffff800008e13d88 x0 : 0000000000000000
Call trace:
schedule_resp+0x2a4/0xa70 [scsi_debug]
scsi_debug_queuecommand+0x2c4/0x9e0 [scsi_debug]
scsi_queue_rq+0x698/0x840
__blk_mq_try_issue_directly+0x108/0x228
blk_mq_request_issue_directly+0x58/0x98
blk_mq_try_issue_list_directly+0x5c/0xf0
blk_mq_sched_insert_requests+0x18c/0x200
blk_mq_flush_plug_list+0x11c/0x190
blk_flush_plug_list+0xdc/0x110
blk_finish_plug+0x38/0x210
blkdev_direct_IO+0x450/0x4d8
generic_file_read_iter+0x84/0x180
blkdev_read_iter+0x3c/0x50
aio_read+0xc0/0x170
io_submit_one+0x5c8/0xc98
__arm64_sys_io_submit+0x1b0/0x258
el0_svc_common.constprop.3+0x68/0x170
do_el0_svc+0x24/0x90
el0_sync_handler+0x13c/0x1a8
el0_sync+0x158/0x180
Code: 528847e0 72a001e0 6b00003f 540018cd (3941c340)
In addition, it should not be less than 1.
So add checks for these, and fail the module init for those cases.
[mkp: changed if condition to match error message]
Link: https://lore.kernel.org/r/1594297400-24756-2-git-send-email-john.garry@huawei.com
Fixes: c483739430f1 ("scsi_debug: add multiple queue support")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-21 11:02:01 +02:00
..
2019-03-13 14:05:01 -07:00
2020-02-28 15:42:27 +01:00
2019-02-20 10:18:35 +01:00
2016-10-26 22:17:43 -04:00
2020-08-21 11:02:01 +02:00
2018-03-22 09:17:43 +01:00
2020-01-14 20:04:31 +01:00
2019-06-22 08:17:20 +02:00
2020-01-23 08:19:43 +01:00
2020-02-14 16:31:05 -05:00
2020-01-23 08:19:37 +01:00
2016-09-14 12:47:42 -04:00
2019-11-10 11:23:14 +01:00
2020-01-23 08:19:42 +01:00
2019-08-11 12:22:12 +02:00
2020-02-05 13:05:52 +00:00
2019-04-05 22:29:06 +02:00
2020-06-30 15:38:23 -04:00
2018-10-20 09:51:30 +02:00
2019-11-28 18:28:24 +01:00
2020-01-29 10:24:28 +01:00
2020-01-12 11:24:10 +01:00
2020-06-30 15:38:22 -04:00
2020-02-14 16:31:10 -05:00
2020-06-30 15:38:24 -04:00
2018-05-25 16:13:08 +02:00
2016-07-20 17:38:35 -06:00
2015-05-31 18:06:28 -07:00
2020-01-04 13:40:59 +01:00
2020-06-30 15:38:21 -04:00
2020-02-14 16:31:05 -05:00
2019-06-22 08:17:24 +02:00
2017-08-06 18:59:49 -07:00
2019-11-25 09:52:13 +01:00
2020-06-11 09:22:21 +02:00
2018-09-19 22:47:14 +02:00
2015-04-27 10:10:19 -07:00
2018-09-19 22:47:14 +02:00
2015-04-27 10:04:39 -07:00
2018-09-19 22:47:14 +02:00
2015-04-27 10:05:55 -07:00
2016-07-13 22:33:23 -04:00
2016-07-13 22:33:23 -04:00
2015-08-07 15:03:42 +02:00
2014-10-20 16:21:33 +02:00
2014-10-20 16:21:33 +02:00
2018-02-25 11:05:53 +01:00
2015-05-31 18:06:28 -07:00
2016-02-23 21:27:02 -05:00
2015-04-09 18:08:31 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-04-17 10:13:56 -07:00
2020-01-04 13:40:54 +01:00
2015-11-25 22:08:55 -05:00
2015-11-25 22:08:52 -05:00
2015-02-02 09:57:45 -08:00
2014-10-20 16:21:33 +02:00
2015-04-14 09:50:27 -07:00
2016-08-16 00:49:32 -04:00
2019-11-28 18:28:27 +01:00
2016-04-11 16:57:09 -04:00
2016-02-23 21:27:02 -05:00
2016-05-10 22:01:07 -04:00
2014-11-24 14:45:27 +01:00
2018-11-13 11:16:51 -08:00
2018-11-13 11:16:51 -08:00
2016-02-23 21:27:02 -05:00
2015-11-09 16:32:14 -08:00
2017-01-12 11:39:29 +01:00
2016-09-29 21:52:43 -04:00
2016-02-25 21:16:49 -05:00
2016-02-25 21:16:49 -05:00
2016-10-07 09:28:53 -07:00
2019-07-10 09:55:43 +02:00
2019-08-25 10:51:46 +02:00
2017-12-20 10:07:22 +01:00
2015-08-12 13:14:57 -07:00
2015-08-12 13:14:57 -07:00
2016-02-25 21:10:53 -05:00
2015-11-20 11:39:03 -05:00
2020-04-02 17:20:32 +02:00
2020-04-02 17:20:32 +02:00
2019-11-28 18:28:23 +01:00
2020-06-30 15:38:28 -04:00
2020-02-28 15:42:34 +01:00
2016-01-27 20:36:10 +08:00
2014-10-20 16:21:33 +02:00
2019-11-10 11:23:15 +01:00
2016-01-27 20:36:10 +08:00
2019-12-21 10:42:33 +01:00
2016-02-05 16:29:28 -06:00
2018-11-13 11:16:51 -08:00
2020-01-04 13:40:54 +01:00
2016-09-26 20:49:25 -04:00
2019-10-29 09:14:57 +01:00
2016-02-05 16:29:28 -06:00
2014-10-20 16:21:33 +02:00
2016-03-05 17:07:46 -05:00
2014-11-24 14:45:27 +01:00
2015-05-31 18:06:28 -07:00
2019-11-25 09:53:05 +01:00
2016-09-14 14:11:12 -04:00
2015-05-31 18:06:28 -07:00
2014-11-24 20:01:28 +01:00
2016-09-04 01:28:07 -04:00
2016-02-23 21:27:02 -05:00
2015-05-31 18:06:28 -07:00
2016-04-30 09:25:26 -07:00
2015-05-31 18:06:28 -07:00
2016-03-01 20:06:49 -05:00
2016-11-28 15:51:31 -05:00
2016-04-04 12:07:42 -04:00
2020-08-21 11:02:01 +02:00
2020-06-30 15:38:37 -04:00
2019-05-08 07:19:10 +02:00
2016-06-18 11:59:01 -07:00
2014-11-12 11:16:12 +01:00
2020-06-20 10:24:07 +02:00
2019-10-07 18:53:15 +02:00
2014-11-12 11:16:05 +01:00
2019-01-23 08:10:54 +01:00
2016-10-07 09:28:53 -07:00
2016-04-11 16:57:09 -04:00
2016-03-14 21:05:04 -04:00
2019-04-05 22:29:08 +02:00
2019-10-29 09:15:19 +01:00
2020-01-23 08:19:43 +01:00
2016-04-11 16:57:09 -04:00
2020-05-02 17:23:04 +02:00
2016-08-18 22:23:20 -04:00
2020-07-31 16:44:01 +02:00
2018-06-06 16:44:38 +02:00
2016-09-26 20:58:42 -04:00
2014-11-12 11:15:54 +01:00
2016-09-15 09:51:14 -04:00
2020-04-02 17:20:33 +02:00
2016-09-15 09:51:14 -04:00
2016-04-11 16:57:09 -04:00
2018-03-22 09:17:55 +01:00
2020-05-20 08:15:34 +02:00
2014-10-20 16:21:33 +02:00
2016-02-23 21:27:02 -05:00
2019-11-10 11:23:14 +01:00
2018-12-13 09:20:29 +01:00
2020-06-30 15:38:23 -04:00
2014-11-12 11:15:57 +01:00
2016-10-18 14:13:37 -07:00
2015-11-18 11:59:09 -05:00
2016-02-23 21:27:02 -05:00
2019-05-08 07:19:10 +02:00
2020-01-04 13:40:54 +01:00
2014-11-20 09:11:15 +01:00
2015-08-10 23:07:05 -04:00
2014-10-20 16:21:33 +02:00
2015-05-31 18:06:28 -07:00
2019-03-23 13:19:46 +01:00
2019-07-10 09:55:39 +02:00
2016-11-01 13:31:23 -04:00
2015-02-02 09:57:46 -08:00
2016-09-01 17:52:01 -07:00
2015-05-31 18:06:28 -07:00
2018-08-24 13:12:29 +02:00