Skip to content

Commit

Permalink
vhost-net: fix vq_memory_access_ok error checking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Dike authored and Michael S. Tsirkin committed Apr 7, 2010
1 parent 535297a commit 179b284
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 179b284

Please sign in to comment.