]> asedeno.scripts.mit.edu Git - linux.git/commit
scsi: scsi_debug: Fix a recently introduced regression
authorBart Van Assche <bvanassche@acm.org>
Fri, 8 Feb 2019 21:21:27 +0000 (13:21 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 12 Feb 2019 16:08:06 +0000 (11:08 -0500)
commitc208556ab3627b5f53144e9cbf739d6371d80543
treece414f3823dd7386e8d352233e110a471b3b5691
parent4a8bec88f71a94f646aeccf26404da710019811d
scsi: scsi_debug: Fix a recently introduced regression

A recent commit removed an element from opcode_info_arr[] but did not
modify opcode_ind_arr[] nor was SDEB_I_XDWRITEREAD removed. Remove
SDEB_I_XDWRITEREAD and bring the two arrays again in sync. This patch
avoids that the following is reported:

BUG: KASAN: null-ptr-deref in scsi_debug_queuecommand+0x60f/0xc90 [scsi_debug]
Read of size 1 at addr 0000000000000001 by task iscsi-test-cu/683
CPU: 3 PID: 683 Comm: iscsi-test-cu Not tainted 5.0.0-rc5-dbg+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
Call Trace:
 dump_stack+0x86/0xca
 kasan_report.cold.3+0x5/0x3e
 __asan_load1+0x47/0x50
 scsi_debug_queuecommand+0x60f/0xc90 [scsi_debug]
 scsi_queue_rq+0xc17/0x12e0
 blk_mq_dispatch_rq_list+0x5fc/0xb10
 blk_mq_sched_dispatch_requests+0x2f7/0x300
 __blk_mq_run_hw_queue+0xd6/0x180
 __blk_mq_delay_run_hw_queue+0x25c/0x290
 blk_mq_run_hw_queue+0x119/0x1b0
 blk_mq_sched_insert_request+0x274/0x350
 blk_execute_rq_nowait+0x78/0x90
 blk_execute_rq+0xcc/0x140
 sg_io+0x30f/0x700
 scsi_cmd_ioctl+0x4d4/0x540
 scsi_cmd_blk_ioctl+0x7b/0x8b
 sd_ioctl+0xba/0x150
 blkdev_ioctl+0x6e1/0xea0
 block_ioctl+0x79/0x90
 do_vfs_ioctl+0x12b/0x9b0
 ksys_ioctl+0x41/0x80
 __x64_sys_ioctl+0x43/0x50
 do_syscall_64+0x71/0x210
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Cc: Christoph Hellwig <hch@lst.de>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Fixes: ae3d56d81507 ("scsi: remove bidirectional command support")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c