linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>,
	Ping Cheng <pingc@wacom.com>,
	Peter Hutterer <peter.hutterer@who-t.net>,
	Aristeu Rozanski <aris@ruivo.org>,
	linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] Input: potential info leak in uiput_ff_upload_to_user()
Date: Fri, 23 Sep 2011 09:22:40 +0300	[thread overview]
Message-ID: <20110923062240.GG4387@elgon.mountain> (raw)

Smatch has a new check for Rosenberg type information leaks where
structs are copied to the user with uninitialized stack data in them.

The issue here is that struct uinput_ff_upload_compat has a hole in
it.

struct uinput_ff_upload_compat {
        int                        request_id;           /*     0     4 */
        int                        retval;               /*     4     4 */
        struct ff_effect_compat    effect;               /*     8     0 */

        /* XXX 44 bytes hole, try to pack */

        struct ff_effect_compat    old;                  /*    52     0 */

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 7360568..40e2ba4 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -528,6 +528,8 @@ static int uinput_ff_upload_to_user(char __user *buffer,
 	if (INPUT_COMPAT_TEST) {
 		struct uinput_ff_upload_compat ff_up_compat;
 
+		memset(&ff_up_compat, 0, sizeof(ff_up_compat));
+
 		ff_up_compat.request_id = ff_up->request_id;
 		ff_up_compat.retval = ff_up->retval;
 		/*

             reply	other threads:[~2011-09-23  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23  6:22 Dan Carpenter [this message]
2011-09-23  7:30 ` [patch] Input: potential info leak in uiput_ff_upload_to_user() Dmitry Torokhov
2011-09-23  7:31 ` Dan Carpenter

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=20110923062240.GG4387@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=aris@ruivo.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.hutterer@who-t.net \
    --cc=pingc@wacom.com \
    --cc=rydberg@euromail.se \
    /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).