vhost-net: fix vq_memory_access_ok error checking

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, April 13, 2010 - 12:59 pm

Gitweb:     http://git.kernel.org/linus/179b284e2fc0c638035843968f7d7ab8ab701525
Commit:     179b284e2fc0c638035843968f7d7ab8ab701525
Parent:     535297a6ae4c3b7a0562e71fac15c213eeec68e7
Author:     Jeff Dike <jdike@addtoit.com>
AuthorDate: Wed Apr 7 09:59:10 2010 -0400
Committer:  Michael S. Tsirkin <mst@redhat.com>
CommitDate: Wed Apr 7 17:04:45 2010 +0300

    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>
---
 drivers/vhost/vhost.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 7bd7a1e..b8e1127 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,
 			       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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
vhost-net: fix vq_memory_access_ok error checking, Linux Kernel Mailing ..., (Tue Apr 13, 12:59 pm)