Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1f79c74 authored by Kumar Amit Mehta's avatar Kumar Amit Mehta Committed by Greg Kroah-Hartman
Browse files

staging: lustre: lustre: mdc: lproc_mdc.c: Fix for potential NULL pointer dereference



In mdc_kuc_write(), OBD_ALLOC(lh, len) may leave 'lh' to NULL as kmalloc
may fail to allocate memory. This fix adds a check to avoid, dereferencing
a NULL pointer.

Signed-off-by: default avatarKumar Amit Mehta <gmate.amit@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e3e981a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ static ssize_t mdc_kuc_write(struct file *file,
		/* for mockup below */ 2 * cfs_size_round(sizeof(*hai));

	OBD_ALLOC(lh, len);
	if (!lh)
		return -ENOMEM;

	lh->kuc_magic = KUC_MAGIC;
	lh->kuc_transport = KUC_TRANSPORT_HSM;