Blame SOURCES/CVE-2021-0512.patch

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