All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Dann Frazier <dann.frazier@canonical.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v4] virtio_blk: Fix an SG_IO regression
Date: Fri, 27 Oct 2017 08:39:47 +0200	[thread overview]
Message-ID: <20171027063947.GA22931@lst.de> (raw)
In-Reply-To: <20171026101015.29855-1-bart.vanassche@wdc.com>

On Thu, Oct 26, 2017 at 12:10:15PM +0200, Bart Van Assche wrote:
> 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>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Dann Frazier <dann.frazier@canonical.com>
> Cc: <stable@vger.kernel.org> # v4.13
> ---
>  drivers/block/virtio_blk.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 34e17ee799be..e477d4a5181e 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -593,10 +593,20 @@ static int virtblk_map_queues(struct blk_mq_tag_set *set)
>  	return blk_mq_virtio_map_queues(set, vblk->vdev, 0);
>  }
>  
> +static void virtblk_initialize_rq(struct request *req)
> +{
> +	struct virtblk_req *vbr = blk_mq_rq_to_pdu(req);
> +
> +#ifdef CONFIG_VIRTIO_BLK_SCSI
> +	scsi_req_init(&vbr->sreq);
> +#endif

How about only defininig the initialize_rq method and implementation
if CONFIG_VIRTIO_BLK_SCSI is set?

Else looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2017-10-27  6:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-26 10:10 [PATCH v4] virtio_blk: Fix an SG_IO regression Bart Van Assche
2017-10-27  6:39 ` Christoph Hellwig [this message]
2017-10-27 14:24   ` Jens Axboe
2017-10-28 17:06     ` Bart Van Assche
2017-10-28 17:06       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171027063947.GA22931@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@wdc.com \
    --cc=dann.frazier@canonical.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.