Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222110

[PATCH] drivers/misc/sgi-gru: fix possible NULL dereference

From Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] drivers/misc/sgi-gru: fix possible NULL dereference
Date 2015-09-10 13:00 +0200
Message-ID <q77K9-7Cu-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/misc/sgi-gru/grutlbpurge.c | 5 +++--
 1 file 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);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] drivers/misc/sgi-gru: fix possible NULL dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-10 13:00 +0200

csiph-web