Skip to content

Commit 2dcdc61

Browse files
tammyleinoarnopo
authored andcommitted
virtqueue_add_buffer must check that there is room for multiple buffers
Ensure there is enough room for all the buffers being added to the vring. Signed-off-by: Tammy Leino <tammy_leino@mentor.com>
1 parent 9b96acc commit 2dcdc61

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/virtio/virtqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int virtqueue_add_buffer(struct virtqueue *vq, struct virtqueue_buf *buf_list,
131131

132132
VQ_PARAM_CHK(vq == NULL, status, ERROR_VQUEUE_INVLD_PARAM);
133133
VQ_PARAM_CHK(needed < 1, status, ERROR_VQUEUE_INVLD_PARAM);
134-
VQ_PARAM_CHK(vq->vq_free_cnt == 0, status, ERROR_VRING_FULL);
134+
VQ_PARAM_CHK(vq->vq_free_cnt < needed, status, ERROR_VRING_FULL);
135135

136136
VQUEUE_BUSY(vq);
137137

0 commit comments

Comments
 (0)