Skip to contentSkip to conversation

cpqarray: check put_user() result

PATCH Applied Kulikov Vasiliy 3 participants 3 messages Jul 29, 2010 – Aug 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpqarray: check put_user() result

put_user() may fail, if so return -EFAULT.

---
 drivers/block/cpqarray.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/block/cpqarray.c +4 -2
index 9473215..d53b029 100644
@@ -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:
 	{
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 42 lines

-----Original Message-----
From: Kulikov Vasiliy [mailto:[email protected]]
Sent: Thursday, July 29, 2010 10:55 AM
To: [email protected]
Cc: Chirag Kantharia; Jens Axboe; Andrew Morton; Alexey Dobriyan; Christoph Hellwig; Arnd Bergmann; ISS StorageDev; [email protected]
Subject: [PATCH] cpqarray: check put_user() result

put_user() may fail, if so return -EFAULT.

---
 drivers/block/cpqarray.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/block/cpqarray.c index 9473215..d53b029 100644

drivers/block/cpqarray.c +4 -2
@@ -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:
Quoted 5 lines

{
--
1.7.0.4

Applied
#2 lore raw
In reply to Kulikov Vasiliy
Quoted 1 line · Kulikov Vasiliy

put_user() may fail, if so return -EFAULT.

Applied.

Signature · 4 lines
Jens Axboe


Confidentiality Notice: This e-mail message, its contents and any attachments to it are confidential to the intended recipient, and may contain information that is privileged and/or exempt from disclosure under applicable law. If you are not the intended recipient, please immediately notify the sender and destroy the original e-mail message and any attachments (and any copies that may have been made) from your system or otherwise. Any unauthorized use, copying, disclosure or distribution of this information is strictly prohibited.