Commit 80897aa7 authored by David Herrmann's avatar David Herrmann Committed by Jiri Kosina

HID: uhid: fix leak for 64/32 UHID_CREATE

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.

Fixes: befde022 ('HID: uhid: make creating devices work on 64/32 systems')
Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 8a396321
...@@ -287,7 +287,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len, ...@@ -287,7 +287,7 @@ static int uhid_event_from_user(const char __user *buffer, size_t len,
*/ */
struct uhid_create_req_compat *compat; struct uhid_create_req_compat *compat;
compat = kmalloc(sizeof(*compat), GFP_KERNEL); compat = kzalloc(sizeof(*compat), GFP_KERNEL);
if (!compat) if (!compat)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment