virtio-blk: fail unaligned requests
commit52c050236eaa4f0b5e1d160cd66dc18106445c4d
authorChristoph Hellwig <hch@lst.de>
Wed, 6 Apr 2011 18:28:34 +0000 (6 20:28 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 7 Apr 2011 13:55:06 +0000 (7 15:55 +0200)
treebed1a80f12117eb1962461886b92aebd4dbfee98
parent155eb9aa09249874b4ff49e94c58595ad82d3abb
virtio-blk: fail unaligned requests

Like all block drivers virtio-blk should not allow small than block size
granularity access.  But given that the protocol specifies a
byte unit length field we currently accept such requests, which cause
qemu to abort() in lower layers.  Add checks to the main read and
write handlers to catch them early.

Reported-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Tested-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/virtio-blk.c