Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target: do not submit a zero-bio I/O request

scsi_setup_fs_cmnd does not like to receive requests with no
bios attached to it. Special-case zero-length reads and writes,
by not submitting any bio.

Testcase: sg_raw /dev/sdb 28 00 00 00 00 00 00 00 00 00
should not fail
panics with the rest of the series but not this patch
behaves correctly without or with this series

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Paolo Bonzini and committed by
Nicholas Bellinger
e0de4457 a50da144

+6
+6
drivers/target/target_core_iblock.c
··· 654 654 goto fail; 655 655 cmd->priv = ibr; 656 656 657 + if (!sgl_nents) { 658 + atomic_set(&ibr->pending, 1); 659 + iblock_complete_cmd(cmd); 660 + return 0; 661 + } 662 + 657 663 bio = iblock_get_bio(cmd, block_lba, sgl_nents); 658 664 if (!bio) 659 665 goto fail_free_ibr;