* [PATCH] i2o/i2o_config: Validate message size
@ 2013-03-02 16:09 Guenter Roeck
0 siblings, 0 replies; only message in thread
From: Guenter Roeck @ 2013-03-02 16:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Guenter Roeck
Message size was already validated against inbound_frame_size, but that does
not guarantee that it is small enough for the buffer used to store a copy of it
on the stack.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
I am also not sure if the previous validation can be trusted, since the size
is read again from user space after the initial validation.
drivers/message/i2o/i2o_config.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 5451bef..aabaafc 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -922,6 +922,10 @@ 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;
--
1.7.9.7
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-03-02 16:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-02 16:09 [PATCH] i2o/i2o_config: Validate message size Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®