staging: lustre: libcfs: test if data is NULL
authorLiang Zhen <liang.zhen@intel.com>
Tue, 22 Mar 2016 23:03:54 +0000 (19:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Mar 2016 14:30:36 +0000 (07:30 -0700)
Make sure data is not NULL otherwise we get an oops
when using the IOC_LIBCFS_MARK_DEBUG ioctl.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11313
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/module.c

index 4c3fe87965457b02f6d4463f991f2fc71ce2e71e..cce6ce35bd8085012f3d28914af713aa81728171 100644 (file)
@@ -150,7 +150,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,
         * Handled in arch/cfs_module.c
         */
        case IOC_LIBCFS_MARK_DEBUG:
-               if (!data->ioc_inlbuf1 ||
+               if (!data || !data->ioc_inlbuf1 ||
                    data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0') {
                        err = -EINVAL;
                        goto out;