staging: lustre: selftest: freeing an error pointer
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Feb 2018 09:15:34 +0000 (12:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:07:44 +0000 (15:07 +0100)
We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.

Fixes: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/selftest/conctl.c

index 3c919a536e91b02beaf61538eeb2375a8685c9d5..51497cf9a8326746ff6451a2d5a81f9a424a1634 100644 (file)
@@ -650,10 +650,8 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
        if (args->lstio_tes_param) {
                param = memdup_user(args->lstio_tes_param,
                                    args->lstio_tes_param_len);
-               if (IS_ERR(param)) {
-                       rc = PTR_ERR(param);
-                       goto out;
-               }
+               if (IS_ERR(param))
+                       return PTR_ERR(param);
        }
 
        rc = -EFAULT;