Skip to content

Commit

Permalink
i2o: fix overflow of copy_to_user()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kulikov Vasiliy authored and Linus Torvalds committed Aug 11, 2010
1 parent 32fa454 commit d929dc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/message/i2o/i2o_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int i2o_cfg_gethrt(unsigned long arg)
put_user(len, kcmd.reslen);
if (len > reslen)
ret = -ENOBUFS;
if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
else if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
ret = -EFAULT;

return ret;
Expand Down

0 comments on commit d929dc2

Please sign in to comment.