From: Jeff Dike Date: Wed, 7 Apr 2010 13:59:10 +0000 (-0400) Subject: vhost-net: fix vq_memory_access_ok error checking X-Git-Tag: MMI-PSA29.97-13-9~23985^2~99^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=179b284e2fc0c638035843968f7d7ab8ab701525;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git vhost-net: fix vq_memory_access_ok error checking vq_memory_access_ok needs to check whether mem == NULL Signed-off-by: Jeff Dike Signed-off-by: Michael S. Tsirkin --- 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, 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;