Skip to contentSkip to conversation

staging: lustre: lustre: obdclass: obd_mount.c: Fix NULL dereference

PATCH New Kumar Amit Mehta 1 participant 1 message Jan 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/staging/lustre/lustre/obdclass/obd_mount.c +5 -0
index 4f39cdee..3c0c910 100644
@@ -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);
 
Signature · 1 line
2.1.0