Blame SOURCES/CVE-2021-0512.patch

bbb66d
From cd6338e72336f073342df3b49a4d6cb7fb6cdbee Mon Sep 17 00:00:00 2001
bbb66d
From: Joe Lawrence <joe.lawrence@redhat.com>
bbb66d
Date: Tue, 26 Oct 2021 10:59:31 -0400
bbb66d
Subject: [KPATCH CVE-2021-0512] HID: kpatch fixes for CVE-2021-0512
bbb66d
bbb66d
Kernels:
bbb66d
4.18.0-305.el8
bbb66d
4.18.0-305.3.1.el8_4
bbb66d
4.18.0-305.7.1.el8_4
bbb66d
4.18.0-305.10.2.el8_4
bbb66d
4.18.0-305.12.1.el8_4
bbb66d
4.18.0-305.17.1.el8_4
bbb66d
4.18.0-305.19.1.el8_4
bbb66d
bbb66d
Changes since last build:
bbb66d
arches: x86_64 ppc64le
bbb66d
hid-core.o: changed function: hid_add_field
bbb66d
---------------------------
bbb66d
bbb66d
Kernels:
bbb66d
4.18.0-305.el8
bbb66d
4.18.0-305.3.1.el8_4
bbb66d
4.18.0-305.7.1.el8_4
bbb66d
4.18.0-305.10.2.el8_4
bbb66d
4.18.0-305.12.1.el8_4
bbb66d
4.18.0-305.17.1.el8_4
bbb66d
4.18.0-305.19.1.el8_4
bbb66d
bbb66d
Modifications: none
bbb66d
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-8/-/merge_requests/5
bbb66d
Approved-by: Artem Savkov (@artem.savkov)
bbb66d
bbb66d
Z-MR: https://gitlab.com/redhat/rhel/src/kernel/rhel-8/-/merge_requests/1350
bbb66d
bbb66d
KT0 test PASS: https://beaker.engineering.redhat.com/jobs/5942710
bbb66d
for kpatch-patch-4_18_0-305-1-6.el8 scratch build:
bbb66d
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=40615898
bbb66d
bbb66d
commit 8ee375b059ce42c0c38f2593f76077d915eee89e
bbb66d
Author: Benjamin Tissoires <benjamin.tissoires@redhat.com>
bbb66d
Date:   Tue Aug 17 09:26:20 2021 +0200
bbb66d
bbb66d
    HID: make arrays usage and value to be the same
bbb66d
bbb66d
    Bugzilla: https://bugzilla.redhat.com/1974941
bbb66d
    CVE: CVE-2021-0512
bbb66d
    Y-Commit: 87ed552fb937790a5d9439c179bb523cfb0efdc6
bbb66d
bbb66d
    O-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1974942
bbb66d
    Upstream Status: since v5.12
bbb66d
    Test: me on the hid-tools test suite
bbb66d
bbb66d
    commit ed9be64eefe26d7d8b0b5b9fa3ffdf425d87a01f
bbb66d
    Author: Will McVicker <willmcvicker@google.com>
bbb66d
    Date:   Sat Dec 5 00:48:48 2020 +0000
bbb66d
bbb66d
        HID: make arrays usage and value to be the same
bbb66d
bbb66d
        The HID subsystem allows an "HID report field" to have a different
bbb66d
        number of "values" and "usages" when it is allocated. When a field
bbb66d
        struct is created, the size of the usage array is guaranteed to be at
bbb66d
        least as large as the values array, but it may be larger. This leads to
bbb66d
        a potential out-of-bounds write in
bbb66d
        __hidinput_change_resolution_multipliers() and an out-of-bounds read in
bbb66d
        hidinput_count_leds().
bbb66d
bbb66d
        To fix this, let's make sure that both the usage and value arrays are
bbb66d
        the same size.
bbb66d
bbb66d
        Cc: stable@vger.kernel.org
bbb66d
        Signed-off-by: Will McVicker <willmcvicker@google.com>
bbb66d
        Signed-off-by: Jiri Kosina <jkosina@suse.cz>
bbb66d
bbb66d
    Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
bbb66d
    Signed-off-by: Julio Faracco <jfaracco@redhat.com>
bbb66d
bbb66d
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
bbb66d
---
bbb66d
 drivers/hid/hid-core.c | 6 +++---
bbb66d
 1 file changed, 3 insertions(+), 3 deletions(-)
bbb66d
bbb66d
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
bbb66d
index d2ecc9c45255..263eca119ff0 100644
bbb66d
--- a/drivers/hid/hid-core.c
bbb66d
+++ b/drivers/hid/hid-core.c
bbb66d
@@ -90,7 +90,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
bbb66d
  * Register a new field for this report.
bbb66d
  */
bbb66d
 
bbb66d
-static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
bbb66d
+static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
bbb66d
 {
bbb66d
 	struct hid_field *field;
bbb66d
 
bbb66d
@@ -101,7 +101,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
bbb66d
 
bbb66d
 	field = kzalloc((sizeof(struct hid_field) +
bbb66d
 			 usages * sizeof(struct hid_usage) +
bbb66d
-			 values * sizeof(unsigned)), GFP_KERNEL);
bbb66d
+			 usages * sizeof(unsigned)), GFP_KERNEL);
bbb66d
 	if (!field)
bbb66d
 		return NULL;
bbb66d
 
bbb66d
@@ -300,7 +300,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
bbb66d
 	usages = max_t(unsigned, parser->local.usage_index,
bbb66d
 				 parser->global.report_count);
bbb66d
 
bbb66d
-	field = hid_register_field(report, usages, parser->global.report_count);
bbb66d
+	field = hid_register_field(report, usages);
bbb66d
 	if (!field)
bbb66d
 		return 0;
bbb66d
 
bbb66d
-- 
bbb66d
2.31.1
bbb66d
bbb66d