Skip to contentSkip to conversation

Fix enqueueing vnet header in discontiguous decs buffer

PATCH Applied Maxime Coquelin 1 participant 4 messages Apr 30, 2018 – May 4, 2018

lore
Share & tools
lore
#0 lore raw

cover Fix enqueueing vnet header in discontiguous decs buffer

This series fixes copying virtio net header to discontiguous descriptor buffer in VA space.

The issue was spotted by Coverity for examples/vhost, but same issue was present in vhost-user library.

Maxime Coquelin (2):
examples/vhost: fix header copy to discontiguous desc buffer
vhost: fix header copy to discontiguous desc buffer

 examples/vhost/virtio_net.c   | 2 +-
 lib/librte_vhost/virtio_net.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/2 examples/vhost: fix header copy to discontiguous desc buffer

In the loop to copy virtio-net header to the descriptor buffer, destination pointer was incremented instead of the source pointer.

Coverity issue: 277240

Fixes 82c93a567d3b ("examples/vhost: move to safe GPA translation API")
---
 examples/vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/vhost/virtio_net.c +1 -1
index 5a965a346..8ea6b36d5 100644
@@ -103,7 +103,7 @@ enqueue_pkt(struct vhost_dev *dev, struct rte_vhost_vring *vr,
 
 			remain -= len;
 			guest_addr += len;
-			dst += len;
+			src += len;
 		}
 
 		desc_chunck_len = desc->len - dev->hdr_len;
Signature · 1 line
2.14.3
#2 lore raw

PATCH 2/2 vhost: fix header copy to discontiguous desc buffer

In reply to Maxime Coquelin

In the loop to copy virtio-net header to the descriptor buffer, destination pointer was incremented instead of the source pointer.

Fixes fb3815cc614d ("vhost: handle virtually non-contiguous buffers in Rx-mrg")
Fixes 6727f5a739b6 ("vhost: handle virtually non-contiguous buffers in Rx")
---
 lib/librte_vhost/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/virtio_net.c +2 -2
index 5fdd4172b..eed6b0227 100644
@@ -277,7 +277,7 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,
 			vhost_log_write(dev, guest_addr, len);
 			remain -= len;
 			guest_addr += len;
-			dst += len;
+			src += len;
 		}
 	}
 
@@ -771,7 +771,7 @@ copy_mbuf_to_desc_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq,
 
 					remain -= len;
 					guest_addr += len;
-					dst += len;
+					src += len;
 				}
 			} else {
 				PRINT_PACKET(dev, (uintptr_t)hdr_addr,
Signature · 1 line
2.14.3
author Applied
#3 lore raw
In reply to Maxime Coquelin
Quoted 6 lines · Maxime Coquelin

This series fixes copying virtio net header to discontiguous descriptor buffer in VA space.

The issue was spotted by Coverity for examples/vhost, but same issue was present in vhost-user library.

Quoted 8 lines

Maxime Coquelin (2):
examples/vhost: fix header copy to discontiguous desc buffer
vhost: fix header copy to discontiguous desc buffer

  examples/vhost/virtio_net.c   | 2 +-
  lib/librte_vhost/virtio_net.c | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

Applied to dpdk-next-virtio/master.