diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-08-10 21:02:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:05 -0400 |
commit | d929dc2bfd8a58c34f1df0680018fa8ea5caa907 (patch) | |
tree | 4efe31c289c00b4ce00b30fce956df5401d6fdde | |
parent | 32fa45498f843fcf56087b8046d8319fcd455ef0 (diff) |
i2o: fix overflow of copy_to_user()
If (len > reslen) we must not call copy_to_user() since kernel buffer is
smaller than we want to copy. Similar code in this file is correct, so
this bug was a typo.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index c4b117f5fb70..4dd39a03082a 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -115,7 +115,7 @@ static int i2o_cfg_gethrt(unsigned long arg) | |||
115 | put_user(len, kcmd.reslen); | 115 | put_user(len, kcmd.reslen); |
116 | if (len > reslen) | 116 | if (len > reslen) |
117 | ret = -ENOBUFS; | 117 | ret = -ENOBUFS; |
118 | if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) | 118 | else if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) |
119 | ret = -EFAULT; | 119 | ret = -EFAULT; |
120 | 120 | ||
121 | return ret; | 121 | return ret; |