mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
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: Kumar Amit Mehta <gmate.amit@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1e3e981ad5
commit
c1f79c74e2
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user