]> git.karo-electronics.de Git - karo-tx-linux.git/commit
target: fix truncation of mode data, support zero allocation length
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Sep 2012 15:30:39 +0000 (17:30 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 7 Sep 2012 18:52:40 +0000 (11:52 -0700)
commit396088c69b902ddd4b4437a9bb9e9c73e603b278
treec4cff7bdc8a629595fe81388fb926b2fd8883e8f
parent7c711e4220f7302419c8942d6b739fca03aabb0a
target: fix truncation of mode data, support zero allocation length

The offset was not bumped back to the full size after writing the
header of the MODE SENSE response, so the last 1 or 2 bytes were
not copied.

On top of this, support zero-length requests by checking for the
return value of transport_kmap_data_sg.

Testcase: sg_raw -r20 /dev/sdb 5a 00 0a 00 00 00 00 00 14 00
    last byte should be 0x1e
    it is 0x00 without the patch
    it is correct with the patch

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_spc.c