aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Krause <xerofoify@gmail.com>2016-01-05 14:32:54 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2016-01-08 13:03:53 -0500
commit7296f62f0322d808362b21064deb34f20799c20d (patch)
treedccfdca44a9910b02c72af94248b717843d74870
parent74e26784f1c50469585f483cf404c2b1d621c101 (diff)
megaraid: Fix possible NULL pointer deference in mraid_mm_ioctl
This adds the needed check after the call to the function mraid_mm_alloc_kioc in order to make sure that this function has not returned NULL and therefore makes sure we do not deference a NULL pointer if one is returned by mraid_mm_alloc_kioc. Further more add needed comments explaining that this function call can return NULL if the list head is empty for the pointer passed in order to allow furture users to understand this required pointer check. Signed-off-by: Nicholas Krause <xerofoify@gmail.com> Acked-by: Sumit Saxena <sumit.saxena@avagotech.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index a70692779a16..4cf9ed96414f 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -179,8 +179,12 @@ mraid_mm_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
179 179
180 /* 180 /*
181 * The following call will block till a kioc is available 181 * The following call will block till a kioc is available
182 * or return NULL if the list head is empty for the pointer
183 * of type mraid_mmapt passed to mraid_mm_alloc_kioc
182 */ 184 */
183 kioc = mraid_mm_alloc_kioc(adp); 185 kioc = mraid_mm_alloc_kioc(adp);
186 if (!kioc)
187 return -ENXIO;
184 188
185 /* 189 /*
186 * User sent the old mimd_t ioctl packet. Convert it to uioc_t. 190 * User sent the old mimd_t ioctl packet. Convert it to uioc_t.