Commit 7de41b12 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio fixes from Michael Tsirkin:
 "Some bug fixes all over the place"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio_balloon: Adjust label in virtballoon_probe
  virtio-blk: improve virtqueue error to BLK_STS
  virtio-blk: fix hw_queue stopped on arbitrary error
  virtio_ring: Fix mem leak with vring_new_virtqueue()
parents 2c523b34 6ae4edab
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -245,14 +245,21 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
	err = virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num);
	if (err) {
		virtqueue_kick(vblk->vqs[qid].vq);
		/* Don't stop the queue if -ENOMEM: we may have failed to
		 * bounce the buffer due to global resource outage.
		 */
		if (err == -ENOSPC)
			blk_mq_stop_hw_queue(hctx);
		spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
		/* Out of mem doesn't actually happen, since we fall back
		 * to direct descriptors */
		if (err == -ENOMEM || err == -ENOSPC)
		switch (err) {
		case -ENOSPC:
			return BLK_STS_DEV_RESOURCE;
		case -ENOMEM:
			return BLK_STS_RESOURCE;
		default:
			return BLK_STS_IOERR;
		}
	}

	if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq))
		notify = true;
+1 −1
Original line number Diff line number Diff line
@@ -959,8 +959,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
	iput(vb->vb_dev_info.inode);
out_kern_unmount:
	kern_unmount(balloon_mnt);
#endif
out_del_vqs:
#endif
	vdev->config->del_vqs(vdev);
out_free_vb:
	kfree(vb);
+2 −2
Original line number Diff line number Diff line
@@ -2203,10 +2203,10 @@ void vring_del_virtqueue(struct virtqueue *_vq)
					 vq->split.queue_size_in_bytes,
					 vq->split.vring.desc,
					 vq->split.queue_dma_addr);

			kfree(vq->split.desc_state);
		}
	}
	if (!vq->packed_ring)
		kfree(vq->split.desc_state);
	list_del(&_vq->list);
	kfree(vq);
}