* [PATCH 1/2] i2o: fix overflow of copy_to_user()
@ 2010-07-15 6:42 Kulikov Vasiliy
0 siblings, 0 replies; only message in thread
From: Kulikov Vasiliy @ 2010-07-15 6:42 UTC (permalink / raw)
To: kernel-janitors
Cc: Andrew Morton, Julia Lawall, Tejun Heo, Jiri Kosina,
Dan Carpenter, linux-kernel
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>
---
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 c4b117f..4dd39a0 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)
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;
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-15 6:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15 6:42 [PATCH 1/2] i2o: fix overflow of copy_to_user() Kulikov Vasiliy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).