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: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6894fdaeaa
commit
f97ef75999
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue