Commit f97ef759 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Greg Kroah-Hartman

drivers/misc/sgi-gru: fix possible NULL dereference

If mmu_find_ops() returns NULL then we are allocating memory for gms
using kzalloc. But kzalloc can return NULL and we were dereferencing gms
in gru_dbg().
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6894fdae
...@@ -317,8 +317,9 @@ struct gru_mm_struct *gru_register_mmu_notifier(void) ...@@ -317,8 +317,9 @@ struct gru_mm_struct *gru_register_mmu_notifier(void)
goto error; goto error;
} }
} }
gru_dbg(grudev, "gms %p, refcnt %d\n", gms, if (gms)
atomic_read(&gms->ms_refcnt)); gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
atomic_read(&gms->ms_refcnt));
return gms; return gms;
error: error:
kfree(gms); kfree(gms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment