linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Tsyrklevich <vlad@tsyrklevich.net>
To: wsa@the-dreams.de
Cc: linux-i2c@vger.kernel.org, Vlad Tsyrklevich <vlad@tsyrklevich.net>
Subject: [PATCH] drivers/i2c/i2c-dev: Fix kernel memory disclosure
Date: Mon,  9 Jan 2017 22:53:36 +0700	[thread overview]
Message-ID: <1483977216-7623-1-git-send-email-vlad@tsyrklevich.net> (raw)

i2c_smbus_xfer() does not always fill an entire block, allowing
kernel stack memory disclosure through the temp variable. Clear
it before it's read to.

Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
---
 drivers/i2c/i2c-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 66f323f..6f638bb 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -331,7 +331,7 @@ static noinline int i2cdev_ioctl_smbus(struct i2c_client *client,
 		unsigned long arg)
 {
 	struct i2c_smbus_ioctl_data data_arg;
-	union i2c_smbus_data temp;
+	union i2c_smbus_data temp = {};
 	int datasize, res;
 
 	if (copy_from_user(&data_arg,
-- 
2.7.0

             reply	other threads:[~2017-01-09 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 15:53 Vlad Tsyrklevich [this message]
2017-01-12 18:36 ` [PATCH] drivers/i2c/i2c-dev: Fix kernel memory disclosure Wolfram Sang
  -- strict thread matches above, loose matches on Subject: below --
2016-10-11 12:52 Vlad Tsyrklevich
2016-10-25  9:45 ` Wolfram Sang
2017-01-09 10:19   ` Vlad Tsyrklevich
2017-01-09 14:48     ` Wolfram Sang

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=1483977216-7623-1-git-send-email-vlad@tsyrklevich.net \
    --to=vlad@tsyrklevich.net \
    --cc=linux-i2c@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).