From: Guenter Roeck <linux@roeck-us.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH] i2o/i2o_config: Validate message size
Date: Sat, 2 Mar 2013 08:09:21 -0800 [thread overview]
Message-ID: <1362240561-26167-1-git-send-email-linux@roeck-us.net> (raw)
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
reply other threads:[~2013-03-02 16:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362240561-26167-1-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®