target: support zero allocation length in INQUIRY
commitac71b560d2d821de7f623fc9d1831981433a9ff3
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Sep 2012 15:30:38 +0000 (7 17:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Oct 2012 16:32:40 +0000 (21 09:32 -0700)
treef332e08c5231f32e14e758c33270ffd7d067a19a
parent6324a752e0113df97f8a59902fcb22c38eede27f
target: support zero allocation length in INQUIRY

commit ffe7b0e9326d9c68f5688bef691dd49f1e0d3651 upstream.

INQUIRY processing already uses an on-heap bounce buffer for loopback,
but not for other fabrics.  Switch this to a cheaper on-stack bounce
buffer, similar to the one used by MODE SENSE and REQUEST SENSE, and
use it unconditionally.  With this in place, zero allocation length is
handled simply by checking the return address of transport_kmap_data_sg.

Testcase: sg_raw /dev/sdb 12 00 83 00 00 00
    should fail with ILLEGAL REQUEST / INVALID FIELD IN CDB sense
    does not fail without the patch
    fails correctly with the series

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/target_core_spc.c