diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2009-09-26 14:50:25 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-10-03 00:59:12 -0400 |
commit | d9f65018065ee1b161a85f54132193f248a45439 (patch) | |
tree | 40b3d3f68ee8bc38f6c455c8722c95241690f058 /drivers/acpi | |
parent | 0efe5e32c8729ef44b00d9a7203e4c99a6378b27 (diff) |
ACPI: Fix bound checks for copy_from_user in the acpi /proc code
The ACPI /proc write() code takes an unsigned length argument like any write()
function, but then assigned it to a *signed* integer called "len".
Only after this is a sanity check for len done to make it not larger than 4.
Due to the type change a len < 0 is in principle also possible; this patch
adds a check for this.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/proc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index d0d550d22a6d..f8b6f555ba52 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -398,6 +398,8 @@ acpi_system_write_wakeup_device(struct file *file, | |||
398 | 398 | ||
399 | if (len > 4) | 399 | if (len > 4) |
400 | len = 4; | 400 | len = 4; |
401 | if (len < 0) | ||
402 | return -EFAULT; | ||
401 | 403 | ||
402 | if (copy_from_user(strbuf, buffer, len)) | 404 | if (copy_from_user(strbuf, buffer, len)) |
403 | return -EFAULT; | 405 | return -EFAULT; |