All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-scsi: Fix assert in virtio_scsi_push_event
Date: Fri, 13 Mar 2015 12:01:54 +0100	[thread overview]
Message-ID: <5502C3A2.3060902@redhat.com> (raw)
In-Reply-To: <1426233354-525-1-git-send-email-famz@redhat.com>



On 13/03/2015 08:55, Fam Zheng wrote:
> Hotplugging a scsi-disk may trigger the assertion in qemu_sgl_concat.
> 
>     qemu-system-x86_64: qemu/hw/scsi/virtio-scsi.c:115: qemu_sgl_concat:
>     Assertion `skip == 0' failed.
> 
> This is introduced by commit 55783a55 (virtio-scsi: work around bug in
> old BIOSes) which didn't check out_num when accessing out_sg[0].iov_len
> (the same to in sg). For virtio_scsi_push_event, looking into out_sg
> doesn't make sense because 0 req_size is intended.
> 
> Cc: qemu-stable@nongnu.org
> [Cc'ing qemu-stable because 55783a55 did it too]
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  hw/scsi/virtio-scsi.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index da0cff8..c9bea06 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -146,8 +146,12 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
>       * TODO: always disable this workaround for virtio 1.0 devices.
>       */
>      if (!virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT)) {
> -        req_size = req->elem.out_sg[0].iov_len;
> -        resp_size = req->elem.in_sg[0].iov_len;
> +        if (req->elem.out_num) {
> +            req_size = req->elem.out_sg[0].iov_len;
> +        }
> +        if (req->elem.in_num) {
> +            resp_size = req->elem.in_sg[0].iov_len;
> +        }
>      }
>  
>      out_size = qemu_sgl_concat(req, req->elem.out_sg,
> 

Thanks, I'll send a pull request next week.

Paolo

      reply	other threads:[~2015-03-13 11:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13  7:55 [Qemu-devel] [PATCH] virtio-scsi: Fix assert in virtio_scsi_push_event Fam Zheng
2015-03-13 11:01 ` Paolo Bonzini [this message]

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=5502C3A2.3060902@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.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.