From: Kumar Amit Mehta Date: Mon, 26 Jan 2015 16:52:22 +0000 (+0100) Subject: staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1e3e981ad576eeb47ca1ca1743ff3b3d39e576a4;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: Greg Kroah-Hartman --- 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);