OSDN Git Service

virtio_blk: avoid DMA to stack for the sense buffer
authorChristoph Hellwig <hch@lst.de>
Mon, 9 Jan 2017 15:56:23 +0000 (08:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jan 2017 19:18:03 +0000 (20:18 +0100)
commit199c89fd32b2a127f12d5614a701e275f7f5a10f
tree8ffb046ec65de51d5e4282b9322ac422a66985a4
parent6c6ae8c43df99284b3260082b43b5858b701bd5e
virtio_blk: avoid DMA to stack for the sense buffer

commit a14d749fcebe97ddf6af6db3d1f6ece85c9ddcb9 upstream.

Most users of BLOCK_PC requests allocate the sense buffer on the stack,
so to avoid DMA to the stack copy them to a field in the heap allocated
virtblk_req structure.  Without that any attempt at SCSI passthrough I/O,
including the SG_IO ioctl from userspace will crash the kernel.  Note that
this includes running tools like hdparm even when the host does not have
SCSI passthrough enabled.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/virtio_blk.c