[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1422291142-4451-1-git-send-email-gmate.amit@gmail.com>
Date: Mon, 26 Jan 2015 17:52:22 +0100
From: Kumar Amit Mehta <gmate.amit@...il.com>
To: oleg.drokin@...el.com, andreas.dilger@...el.com
Cc: gregkh@...uxfoundation.org, Julia.Lawall@...6.fr,
john.hammond@...el.com, gdonald@...il.com, joe@...ches.com,
daeseok.youn@...il.com, Andriy_Skulysh@...atex.com,
HPDD-discuss@...ts.01.org, devel@...verdev.osuosl.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists