projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
79bae42
)
i2o: check copy_from_user() size parameter
author
Dan Carpenter
<
[email protected]
>
Tue, 30 Apr 2013 22:27:47 +0000
(15:27 -0700)
committer
Linus Torvalds
<
[email protected]
>
Wed, 1 May 2013 00:04:04 +0000
(17:04 -0700)
Limit the size of the copy so we don't corrupt memory. Hopefully this
can only be called by root, but fixing this makes the static checkers
happier.
Signed-off-by: Dan Carpenter <
[email protected]
>
Cc: Jiri Kosina <
[email protected]
>
Cc: Masanari Iida <
[email protected]
>
Cc: Alan Cox <
[email protected]
>
Cc: Guenter Roeck <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/message/i2o/i2o_config.c
patch
|
blob
|
history
diff --git
a/drivers/message/i2o/i2o_config.c
b/drivers/message/i2o/i2o_config.c
index 5451beff183ffdf69e24d5d1ca016d11215882a2..a60c188c2bd937255f60f42920e4b9fbba68cb88 100644
(file)
--- a/
drivers/message/i2o/i2o_config.c
+++ b/
drivers/message/i2o/i2o_config.c
@@
-687,6
+687,11
@@
static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
}
size = size >> 16;
size *= 4;
+ if (size > sizeof(rmsg)) {
+ rcode = -EINVAL;
+ goto sg_list_cleanup;
+ }
+
/* Copy in the user's I2O command */
if (copy_from_user(rmsg, user_msg, size)) {
rcode = -EFAULT;
@@
-922,6
+927,11
@@
static int i2o_cfg_passthru(unsigned long arg)
}
size = size >> 16;
size *= 4;
+ if (size > sizeof(rmsg)) {
+ rcode = -EFAULT;
+ goto sg_list_cleanup;
+ }
+
/* Copy in the user's I2O command */
if (copy_from_user(rmsg, user_msg, size)) {
rcode = -EFAULT;