Skip to content

Commit 179b284

Browse files
cfd-36mstsirkin
authored andcommitted
vhost-net: fix vq_memory_access_ok error checking
vq_memory_access_ok needs to check whether mem == NULL Signed-off-by: Jeff Dike <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 535297a commit 179b284

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/vhost/vhost.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
235235
int log_all)
236236
{
237237
int i;
238+
239+
if (!mem)
240+
return 0;
241+
238242
for (i = 0; i < mem->nregions; ++i) {
239243
struct vhost_memory_region *m = mem->regions + i;
240244
unsigned long a = m->userspace_addr;

0 commit comments

Comments
 (0)