All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] virtio_blk: Fix an SG_IO regression
@ 2017-10-25  9:56 Bart Van Assche
  2017-10-25 18:23 ` Jens Axboe
  0 siblings, 1 reply; 11+ messages in thread
From: Bart Van Assche @ 2017-10-25  9:56 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Bart Van Assche,
	Michael S . Tsirkin, Dann Frazier, stable

Avoid that submitting an SG_IO ioctl triggers a kernel oops that
is preceded by:

usercopy: kernel memory overwrite attempt detected to (null) (<null>) (6 bytes)
kernel BUG at mm/usercopy.c:72!

Reported-by: Dann Frazier <dann.frazier@canonical.com>
Fixes: commit ca18d6f769d2 ("block: Make most scsi_req_init() calls implicit")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Tested-by: Dann Frazier <dann.frazier@canonical.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Dann Frazier <dann.frazier@canonical.com>
Cc: <stable@vger.kernel.org> # v4.13
---
 drivers/block/Kconfig      | 1 +
 drivers/block/virtio_blk.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 4a438b8abe27..b0b2100763bf 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -450,6 +450,7 @@ config VIRTIO_BLK_SCSI
 	bool "SCSI passthrough request for the Virtio block driver"
 	depends on VIRTIO_BLK
 	select BLK_SCSI_REQUEST
+	select SCSI_MOD
 	---help---
 	  Enable support for SCSI passthrough (e.g. the SG_IO ioctl) on
 	  virtio-blk devices.  This is only supported for the legacy
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 34e17ee799be..15e11a519801 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -597,6 +597,7 @@ static const struct blk_mq_ops virtio_mq_ops = {
 	.queue_rq	= virtio_queue_rq,
 	.complete	= virtblk_request_done,
 	.init_request	= virtblk_init_request,
+	.initialize_rq_fn = scsi_initialize_rq,
 	.map_queues	= virtblk_map_queues,
 };
 
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-26  4:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-25  9:56 [PATCH v2] virtio_blk: Fix an SG_IO regression Bart Van Assche
2017-10-25 18:23 ` Jens Axboe
2017-10-25 19:25   ` Bart Van Assche
2017-10-25 19:25     ` Bart Van Assche
2017-10-25 19:34     ` Jens Axboe
2017-10-25 19:37       ` hch
2017-10-26  4:33         ` Bart Van Assche
2017-10-26  4:33           ` Bart Van Assche
2017-10-26  4:38           ` Jens Axboe
2017-10-26  4:44       ` Bart Van Assche
2017-10-26  4:44         ` Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.