]> git.karo-electronics.de Git - karo-tx-linux.git/commit
virtio_mmio: Don't attempt to create empty virtqueues
authorBrian Foley <brian.foley@arm.com>
Mon, 24 Sep 2012 13:33:42 +0000 (14:33 +0100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Sep 2012 23:50:46 +0000 (09:50 +1000)
commit2feb41c726bbd62147cfce7b821c8a8f0d2787ba
tree90a60e5fec3b1f25734e9e5c5779b2d934a1be57
parent6cb203a36138de88be6df78fcd732730f93bec50
virtio_mmio: Don't attempt to create empty virtqueues

If a virtio device reports a QueueNumMax of 0, vring_new_virtqueue()
doesn't check this, and thanks to an unsigned (i < num - 1) loop
guard, scribbles over memory when initialising the free list.

Avoid by not trying to create zero-descriptor queues, as there's no
way to do any I/O with one.

Signed-off-by: Brian Foley <brian.foley@arm.com>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_mmio.c