From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
To: rusty@rustcorp.com.au, virtualization@lists.linux-foundation.org
Cc: borntraeger@de.ibm.com, mst@redhat.com
Subject: [PATCH V2 RFC 9/9] virtio_scsi: verify if queue is broken after virtqueue_get_buf()
Date: Mon, 4 Nov 2013 12:14:57 +0100 [thread overview]
Message-ID: <1383563697-37309-2-git-send-email-graalfs@linux.vnet.ibm.com> (raw)
In-Reply-To: <1383563697-37309-1-git-send-email-graalfs@linux.vnet.ibm.com>
If virtqueue_get_buf() returned with a NULL pointer avoid a possibly
endless loop by checking for a broken virtqueue.
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
---
drivers/scsi/virtio_scsi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 74b88ef..aa25aab 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -224,6 +224,9 @@ static void virtscsi_vq_done(struct virtio_scsi *vscsi,
virtqueue_disable_cb(vq);
while ((buf = virtqueue_get_buf(vq, &len)) != NULL)
fn(vscsi, buf);
+
+ if (unlikely(virtqueue_is_broken(vq)))
+ break;
} while (!virtqueue_enable_cb(vq));
spin_unlock_irqrestore(&virtscsi_vq->vq_lock, flags);
}
--
1.8.3.1
next prev parent reply other threads:[~2013-11-04 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 11:14 [PATCH V2 RFC 9/9] virtio_scsi: verify if queue is broken after virtqueue_get_buf() Heinz Graalfs
2013-11-04 11:14 ` Heinz Graalfs [this message]
2013-11-05 1:57 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2013-10-24 15:23 [PATCH V2 RFC 0/9] virtio: fix hang(loop) after hot-unplug vlan Heinz Graalfs
2013-10-24 15:23 ` [PATCH V2 RFC 9/9] virtio_scsi: verify if queue is broken after virtqueue_get_buf() Heinz Graalfs
2013-10-27 23:29 ` Rusty Russell
2013-10-29 1:04 ` Rusty Russell
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=1383563697-37309-2-git-send-email-graalfs@linux.vnet.ibm.com \
--to=graalfs@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=mst@redhat.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).