From: David Herrmann Date: Tue, 26 Nov 2013 12:58:18 +0000 (+0100) Subject: HID: uhid: fix leak for 64/32 UHID_CREATE X-Git-Tag: Ubuntu-5.2.0-15.16~14442^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=80897aa787ecd58eabb29deab7cbec9249c9b7e6;p=mirror_ubuntu-eoan-kernel.git 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: befde0226a59 ('HID: uhid: make creating devices work on 64/32 systems') Reported-by: Ben Hutchings Signed-off-by: David Herrmann Cc: stable@vger.kernel.org Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 93b00d76374c..cedc6da93c19 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;