Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3afe3e0f authored by Rusty Russell's avatar Rusty Russell
Browse files

tools/lguest: handle indirect partway through chain.



Linux doesn't generate these, but it's perfectly valid according to
a close reading of the spec.  I opened virtio spec bug VIRTIO-134 to
make this clearer there, too.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent c97eb679
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -769,9 +769,11 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq,
	 * that: no rmb() required.
	 */

	do {
		/*
	 * If this is an indirect entry, then this buffer contains a descriptor
	 * table which we handle as if it's any normal descriptor chain.
		 * If this is an indirect entry, then this buffer contains a
		 * descriptor table which we handle as if it's any normal
		 * descriptor chain.
		 */
		if (desc[i].flags & VRING_DESC_F_INDIRECT) {
			if (desc[i].len % sizeof(struct vring_desc))
@@ -782,7 +784,6 @@ static unsigned wait_for_vq_desc(struct virtqueue *vq,
			i = 0;
		}

	do {
		/* Grab the first descriptor, and check it's OK. */
		iov[*out_num + *in_num].iov_len = desc[i].len;
		iov[*out_num + *in_num].iov_base