diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2015-09-10 10:52:03 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-21 02:33:29 (GMT) |
commit | f97ef759999485df485fe19a440d6af02d561140 (patch) | |
tree | 5fb3e3b27140600043946616400e64822f8e3cf0 /drivers/misc/sgi-gru | |
parent | 6894fdaeaa2a653c3232b11926df8c7e8b5bd83c (diff) | |
download | linux-f97ef759999485df485fe19a440d6af02d561140.tar.xz |
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>
Diffstat (limited to 'drivers/misc/sgi-gru')
-rw-r--r-- | drivers/misc/sgi-gru/grutlbpurge.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c index 2129274..757a8e9 100644 --- a/drivers/misc/sgi-gru/grutlbpurge.c +++ b/drivers/misc/sgi-gru/grutlbpurge.c @@ -317,8 +317,9 @@ struct gru_mm_struct *gru_register_mmu_notifier(void) goto error; } } - gru_dbg(grudev, "gms %p, refcnt %d\n", gms, - atomic_read(&gms->ms_refcnt)); + if (gms) + gru_dbg(grudev, "gms %p, refcnt %d\n", gms, + atomic_read(&gms->ms_refcnt)); return gms; error: kfree(gms); |