summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre
diff options
context:
space:
mode:
authorKumar Amit Mehta <gmate.amit@gmail.com>2015-01-26 17:52:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-28 10:52:05 -0800
commit1e3e981ad576eeb47ca1ca1743ff3b3d39e576a4 (patch)
tree269490b66a0f709ad5afb524a909874fa0232a53 /drivers/staging/lustre
parentef99fd59f122ace847636b9143f33197c51f18b5 (diff)
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@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r--drivers/staging/lustre/lustre/obdclass/obd_mount.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 4f39cdee1b5c..3c0c9109cefd 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);