cpqarray: check put_user() result
authorKulikov Vasiliy <segooon@gmail.com>
Tue, 3 Aug 2010 10:52:55 +0000 (12:52 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:53:03 +0000 (18:53 +0200)
put_user() may fail, if so return -EFAULT.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
drivers/block/cpqarray.c

index 9473215956f93c5a3ec086307461f2255945f6bb..d53b0291c44ba0f175b8546c118b6eaffcac3a1d 100644 (file)
@@ -1179,7 +1179,8 @@ out_passthru:
                return error;
        case IDAGETCTLRSIG:
                if (!arg) return -EINVAL;
-               put_user(host->ctlr_sig, (int __user *)arg);
+               if (put_user(host->ctlr_sig, (int __user *)arg))
+                       return -EFAULT;
                return 0;
        case IDAREVALIDATEVOLS:
                if (MINOR(bdev->bd_dev) != 0)
@@ -1187,7 +1188,8 @@ out_passthru:
                return revalidate_allvol(host);
        case IDADRIVERVERSION:
                if (!arg) return -EINVAL;
-               put_user(DRIVER_VERSION, (unsigned long __user *)arg);
+               if (put_user(DRIVER_VERSION, (unsigned long __user *)arg))
+                       return -EFAULT;
                return 0;
        case IDAGETPCIINFO:
        {