projects
/
GitHub
/
LineageOS
/
G12
/
android_kernel_amlogic_linux-4.9.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cdd77e8
)
virtio_scsi: verify if queue is broken after virtqueue_get_buf()
author
Heinz Graalfs
<graalfs@linux.vnet.ibm.com>
Mon, 11 Nov 2013 01:22:43 +0000
(11:52 +1030)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Mon, 11 Nov 2013 01:23:26 +0000
(11:53 +1030)
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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/scsi/virtio_scsi.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/scsi/virtio_scsi.c
b/drivers/scsi/virtio_scsi.c
index e6bb2352df40d5759115108b071fa454c8f7a688..c3173dced87038f41b00d918d1f114ceaac09208 100644
(file)
--- 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);
}