LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference
@ 2015-01-26 16:52 Kumar Amit Mehta
  0 siblings, 0 replies; only message in thread
From: Kumar Amit Mehta @ 2015-01-26 16:52 UTC (permalink / raw)
  To: oleg.drokin, andreas.dilger
  Cc: gregkh, Julia.Lawall, john.hammond, gdonald, joe, daeseok.youn,
	Andriy_Skulysh, HPDD-discuss, devel, kernel-janitors,
	linux-kernel

OBD_ALLOC_PTR(uuid) invokes kmalloc, which may return NULL. This fix
adds a check before dereferencing such pointer.

Signed-off-by: Kumar Amit Mehta <gmate.amit@gmail.com>
---
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 4f39cdee..3c0c910 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -376,6 +376,11 @@ int lustre_start_mgc(struct super_block *sb)
 
 	/* Random uuid for MGC allows easier reconnects */
 	OBD_ALLOC_PTR(uuid);
+	if (!uuid) {
+		rc = -ENOMEM;
+		goto out_free;
+	}
+
 	ll_generate_random_uuid(uuidc);
 	class_uuid_unparse(uuidc, uuid);
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-26 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 16:52 [PATCH] staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference Kumar Amit Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).