Skip to content

Commit

Permalink
virtqueue_add_buffer must check that there is room for multiple buffers
Browse files Browse the repository at this point in the history
Ensure there is enough room for all the buffers being added to the vring.
Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
  • Loading branch information
tammyleino authored and arnopo committed Apr 14, 2022
1 parent 9b96acc commit 2dcdc61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/virtio/virtqueue.c
Expand Up @@ -131,7 +131,7 @@ int virtqueue_add_buffer(struct virtqueue *vq, struct virtqueue_buf *buf_list,

VQ_PARAM_CHK(vq == NULL, status, ERROR_VQUEUE_INVLD_PARAM);
VQ_PARAM_CHK(needed < 1, status, ERROR_VQUEUE_INVLD_PARAM);
VQ_PARAM_CHK(vq->vq_free_cnt == 0, status, ERROR_VRING_FULL);
VQ_PARAM_CHK(vq->vq_free_cnt < needed, status, ERROR_VRING_FULL);

VQUEUE_BUSY(vq);

Expand Down

0 comments on commit 2dcdc61

Please sign in to comment.