Skip to contentSkip to conversation

vhost-net: fix vq_memory_access_ok error checking

PATCH Michael S. Tsirkin 1 participant 2 messages Apr 13, 2010

Subsystems (4)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw
Quoted 4 lines · Jeff Dike

vq_memory_access_ok needs to check whether mem == NULL

This was already queued by me, you do not need to
fill Dave's inbox with vhost patches.

Quoted 21 lines
---
 drivers/vhost/vhost.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/vhost/vhost.c +4 -0
index 7bd7a1e..b8e1127 100644
@@ -235,6 +235,10 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
 			       int log_all)
 {
 	int i;
+
+        if (!mem)
+                return 0;
+
 	for (i = 0; i < mem->nregions; ++i) {
 		struct vhost_memory_region *m = mem->regions + i;
 		unsigned long a = m->userspace_addr;
Signature · 1 line
1.7.0.2.280.gc6f05
author maintainer
#1 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 4 lines · Jeff Dike

vq_memory_access_ok needs to check whether mem == NULL

This was already queued by me, you do not need to
fill Dave's inbox with vhost patches.

This was sent in error, please ignore.
Sorry about the noise.

Quoted 21 lines
Quoted 21 lines
---
 drivers/vhost/vhost.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/vhost/vhost.c +4 -0
index 7bd7a1e..b8e1127 100644
@@ -235,6 +235,10 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
 			       int log_all)
 {
 	int i;
+
+        if (!mem)
+                return 0;
+
 	for (i = 0; i < mem->nregions; ++i) {
 		struct vhost_memory_region *m = mem->regions + i;
 		unsigned long a = m->userspace_addr;
Signature · 1 line
1.7.0.2.280.gc6f05