]> Git Repo - linux.git/commitdiff
HID: core: zero-initialize the report buffer
authorJiri Kosina <[email protected]>
Tue, 29 Oct 2024 14:44:35 +0000 (15:44 +0100)
committerJiri Kosina <[email protected]>
Tue, 29 Oct 2024 14:44:42 +0000 (15:44 +0100)
Since the report buffer is used by all kinds of drivers in various ways, let's
zero-initialize it during allocation to make sure that it can't be ever used
to leak kernel memory via specially-crafted report.

Fixes: 27ce405039bf ("HID: fix data access in implement()")
Reported-by: BenoĆ®t Sevens <[email protected]>
Acked-by: Benjamin Tissoires <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
drivers/hid/hid-core.c

index 30de92d0bf0f2f932edab57c1e81da2874a34f9c..4aee4eae50fd38b4ec28b1ce6e132c59abf7c479 100644 (file)
@@ -1875,7 +1875,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
 
        u32 len = hid_report_len(report) + 7;
 
-       return kmalloc(len, flags);
+       return kzalloc(len, flags);
 }
 EXPORT_SYMBOL_GPL(hid_alloc_report_buf);
 
This page took 0.069642 seconds and 4 git commands to generate.