diff options
| author | Jiri Kosina <jkosina@suse.com> | 2024-10-29 15:44:35 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-14 13:15:10 +0100 |
| commit | 1884ab3d22536a5c14b17c78c2ce76d1734e8b0b (patch) | |
| tree | e1bbca563d512b4d61e0fb5afbda83d7a1588b07 | |
| parent | 5d739ad16ca3e2c183cb2b829da084692845176e (diff) | |
| download | linux-1884ab3d22536a5c14b17c78c2ce76d1734e8b0b.tar.gz linux-1884ab3d22536a5c14b17c78c2ce76d1734e8b0b.tar.bz2 linux-1884ab3d22536a5c14b17c78c2ce76d1734e8b0b.zip | |
HID: core: zero-initialize the report buffer
[ Upstream commit 177f25d1292c7e16e1199b39c85480f7f8815552 ]
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 <bsevens@google.com>
Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/hid/hid-core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index e2e52aa0eeba..b5887658c6af 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1878,7 +1878,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); |
