[PATCH openEuler-1.0-LTS 0/3] bugfix set of CVEs
bugfix set of CVEs Lee Jones (2): HID: core: Mitigate potential OOB by removing bogus memset() HID: multitouch: Check to ensure report responses match the request Vicki Pfau (1): HID: core: Add printk_ratelimited variants to hid_warn() etc drivers/hid/hid-core.c | 7 ++++--- drivers/hid/hid-multitouch.c | 7 +++++++ include/linux/hid.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) -- 2.34.1
From: Vicki Pfau <vi@endrift.com> mainline inclusion from mainline-v6.18-rc2 commit 1d64624243af8329b4b219d8c39e28ea448f9929 category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/14580 CVE: CVE-2026-43048 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- hid_warn_ratelimited() is needed. Add the others as part of the block. Signed-off-by: Vicki Pfau <vi@endrift.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Conflicts: include/linux/hid.h [cherry-pick applied cleanly without conflicts, but the patch context differs.] Signed-off-by: Liu Kai <liukai284@huawei.com> --- include/linux/hid.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/hid.h b/include/linux/hid.h index 2053f3ee4395..4ea93c58d322 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -1196,4 +1196,15 @@ do { \ #define hid_dbg(hid, fmt, arg...) \ dev_dbg(&(hid)->dev, fmt, ##arg) +#define hid_err_ratelimited(hid, fmt, ...) \ + dev_err_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_notice_ratelimited(hid, fmt, ...) \ + dev_notice_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_warn_ratelimited(hid, fmt, ...) \ + dev_warn_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_info_ratelimited(hid, fmt, ...) \ + dev_info_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__) +#define hid_dbg_ratelimited(hid, fmt, ...) \ + dev_dbg_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__) + #endif -- 2.34.1
From: Lee Jones <lee@kernel.org> mainline inclusion from mainline-v7.0-rc5 commit 0a3fe972a7cb1404f693d6f1711f32bc1d244b1c category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/14580 CVE: CVE-2026-43048 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- The memset() in hid_report_raw_event() has the good intention of clearing out bogus data by zeroing the area from the end of the incoming data string to the assumed end of the buffer. However, as we have previously seen, doing so can easily result in OOB reads and writes in the subsequent thread of execution. The current suggestion from one of the HID maintainers is to remove the memset() and simply return if the incoming event buffer size is not large enough to fill the associated report. Suggested-by Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Lee Jones <lee@kernel.org> [bentiss: changed the return value] Signed-off-by: Benjamin Tissoires <bentiss@kernel.org> Conflicts: drivers/hid/hid-core.c [cherry-pick applied cleanly without conflicts, but the patch context differs.] Signed-off-by: Liu Kai <liukai284@huawei.com> --- drivers/hid/hid-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index c0446ee3d4a0..61b614072e05 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1576,9 +1576,10 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, rsize = HID_MAX_BUFFER_SIZE; if (csize < rsize) { - dbg_hid("report %d is too short, (%d < %d)\n", report->id, - csize, rsize); - memset(cdata + csize, 0, rsize - csize); + hid_warn_ratelimited(hid, "Event data for report %d was too short (%d vs %d)\n", + report->id, rsize, csize); + ret = -EINVAL; + goto out; } if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) -- 2.34.1
From: Lee Jones <lee@kernel.org> mainline inclusion from mainline-v7.0-rc5 commit e716edafedad4952fe3a4a273d2e039a84e8681a category: bugfix bugzilla: https://atomgit.com/src-openeuler/kernel/issues/14579 CVE: CVE-2026-43047 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- It is possible for a malicious (or clumsy) device to respond to a specific report's feature request using a completely different report ID. This can cause confusion in the HID core resulting in nasty side-effects such as OOB writes. Add a check to ensure that the report ID in the response, matches the one that was requested. If it doesn't, omit reporting the raw event and return early. Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Liu Kai <liukai284@huawei.com> --- drivers/hid/hid-multitouch.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6bd95a13eb24..d77ec5711c17 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -428,12 +428,19 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) dev_warn(&hdev->dev, "failed to fetch feature %d\n", report->id); } else { + /* The report ID in the request and the response should match */ + if (report->id != buf[0]) { + hid_err(hdev, "Returned feature report did not match the request\n"); + goto free; + } + ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf, size, 0); if (ret) dev_warn(&hdev->dev, "failed to report feature\n"); } +free: kfree(buf); } -- 2.34.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/22431 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/U4H... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/22431 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/U4H...
participants (2)
-
Liu Kai -
patchwork bot