]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
megaraid: Fix possible NULL pointer deference in mraid_mm_ioctl
authorNicholas Krause <xerofoify@gmail.com>
Tue, 5 Jan 2016 19:32:54 +0000 (14:32 -0500)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 29 Feb 2016 16:03:50 +0000 (09:03 -0700)
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>
(cherry picked from commit 7296f62f0322d808362b21064deb34f20799c20d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/scsi/megaraid/megaraid_mm.c

index a70692779a16c770300b410eda56a9f1823e9239..4cf9ed96414f05c881221dabcc18ca5717bd2c11 100644 (file)
@@ -179,8 +179,12 @@ mraid_mm_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 
        /*
         * The following call will block till a kioc is available
+        * or return NULL if the list head is empty for the pointer
+        * of type mraid_mmapt passed to mraid_mm_alloc_kioc
         */
        kioc = mraid_mm_alloc_kioc(adp);
+       if (!kioc)
+               return -ENXIO;
 
        /*
         * User sent the old mimd_t ioctl packet. Convert it to uioc_t.