aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2010-04-07 09:59:10 -0400
committerMichael S. Tsirkin <mst@redhat.com>2010-04-07 10:04:45 -0400
commit179b284e2fc0c638035843968f7d7ab8ab701525 (patch)
tree6876a4fa365d13be8fb137856bf183e4085f77d7 /drivers/vhost
parent535297a6ae4c3b7a0562e71fac15c213eeec68e7 (diff)
vhost-net: fix vq_memory_access_ok error checking
vq_memory_access_ok needs to check whether mem == NULL Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/vhost.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 7bd7a1e4409d..b8e112720812 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -235,6 +235,10 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
235 int log_all) 235 int log_all)
236{ 236{
237 int i; 237 int i;
238
239 if (!mem)
240 return 0;
241
238 for (i = 0; i < mem->nregions; ++i) { 242 for (i = 0; i < mem->nregions; ++i) {
239 struct vhost_memory_region *m = mem->regions + i; 243 struct vhost_memory_region *m = mem->regions + i;
240 unsigned long a = m->userspace_addr; 244 unsigned long a = m->userspace_addr;