From f6c4c8e19a087dae7dc651ccbd1ff8b843eedee2 Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Tue, 3 Aug 2010 12:52:55 +0200 Subject: cpqarray: check put_user() result put_user() may fail, if so return -EFAULT. Signed-off-by: Kulikov Vasiliy Acked-by: Mike Miller Signed-off-by: Jens Axboe --- drivers/block/cpqarray.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 9473215956f9..d53b0291c44b 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -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: { -- cgit v1.2.3