From: David Herrmann <dh.herrmann@gmail.com>
To: linux-input@vger.kernel.org
Cc: Ben Hutchings <ben@decadent.org.uk>,
Jiri Kosina <jkosina@suse.cz>,
David Herrmann <dh.herrmann@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v2] HID: uhid: fix leak for 64/32 UHID_CREATE
Date: Tue, 26 Nov 2013 13:58:18 +0100 [thread overview]
Message-ID: <1385470698-6036-1-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1385449330.23855.46.camel@deadeye.wl.decadent.org.uk>
UHID allows short writes so user-space can omit unused fields. We
automatically set them to 0 in the kernel. However, the 64/32 bit
compat-handler didn't do that in the UHID_CREATE fallback. This will
reveal random kernel heap data (of random size, even) to user-space.
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/hid/uhid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 93b00d7..cedc6da 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -287,7 +287,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len,
*/
struct uhid_create_req_compat *compat;
- compat = kmalloc(sizeof(*compat), GFP_KERNEL);
+ compat = kzalloc(sizeof(*compat), GFP_KERNEL);
if (!compat)
return -ENOMEM;
--
1.8.4.2
next prev parent reply other threads:[~2013-11-26 12:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 7:02 [PATCH] uhid: Pad short UHID_CREATE writes from compat tasks Ben Hutchings
2013-11-26 12:45 ` David Herrmann
2013-11-26 12:58 ` David Herrmann [this message]
2013-11-26 14:29 ` [PATCH v2] HID: uhid: fix leak for 64/32 UHID_CREATE Ben Hutchings
2013-11-27 9:54 ` Jiri Kosina
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=1385470698-6036-1-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=ben@decadent.org.uk \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).