Thread (25 messages) 25 messages, 3 authors, 2019-10-10
STALE2446d
Revisions (25)
  1. rfc [diff vs current]
  2. v2 [diff vs current]
  3. v2 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v2 [diff vs current]
  7. v2 current
  8. v3 [diff vs current]
  9. v3 [diff vs current]
  10. v4 [diff vs current]
  11. v4 [diff vs current]
  12. v5 [diff vs current]
  13. v6 [diff vs current]
  14. v6 [diff vs current]
  15. v7 [diff vs current]
  16. v7 [diff vs current]
  17. v8 [diff vs current]
  18. v8 [diff vs current]
  19. v9 [diff vs current]
  20. v9 [diff vs current]
  21. v10 [diff vs current]
  22. v10 [diff vs current]
  23. v11 [diff vs current]
  24. v12 [diff vs current]
  25. v13 [diff vs current]

[PATCH V2 1/8] vringh: fix copy direction of vringh_iov_push_kern()

From: Jason Wang <jasowang@redhat.com>
Date: 2019-09-24 13:54:33
Also in: dri-devel, intel-gfx, kvm, linux-s390, lkml
Subsystem: the rest, virtio host (vhost) · Maintainers: Linus Torvalds, "Michael S. Tsirkin", Jason Wang

We want to copy from iov to buf, so the direction was wrong.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vringh.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 08ad0d1f0476..a0a2d74967ef 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len)
 	return 0;
 }
 
+static inline int kern_xfer(void *dst, void *src, size_t len)
+{
+	memcpy(dst, src, len);
+	return 0;
+}
+
 /**
  * vringh_init_kern - initialize a vringh for a kernelspace vring.
  * @vrh: the vringh to initialize.
@@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern);
 ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
 			     const void *src, size_t len)
 {
-	return vringh_iov_xfer(wiov, (void *)src, len, xfer_kern);
+	return vringh_iov_xfer(wiov, (void *)src, len, kern_xfer);
 }
 EXPORT_SYMBOL(vringh_iov_push_kern);
 
-- 
2.19.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help