]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fix up hid patch
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2025 13:55:51 +0000 (15:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Apr 2025 13:55:51 +0000 (15:55 +0200)
queue-5.10/hid-pidff-fix-null-pointer-dereference-in-pidff_find.patch
queue-5.15/hid-pidff-fix-null-pointer-dereference-in-pidff_find.patch
queue-5.4/hid-pidff-fix-null-pointer-dereference-in-pidff_find.patch

index c05559b162080bce798c85cc64be6fb990dc1f6b..850cd926bc772f0cd2200c4b048b1ff2fbfd6154 100644 (file)
@@ -31,38 +31,34 @@ Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
 Tested-by: Pablo Cisneros <patchkez@protonmail.com>
 Signed-off-by: Jiri Kosina <jkosina@suse.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/hid/usbhid/hid-pidff.c | 10 ++++++++++
+ drivers/hid/usbhid/hid-pidff.c |   10 ++++++++++
  1 file changed, 10 insertions(+)
 
-diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
-index ba0d7cb15377e..7801294fe086d 100644
 --- a/drivers/hid/usbhid/hid-pidff.c
 +++ b/drivers/hid/usbhid/hid-pidff.c
-@@ -770,6 +770,11 @@ static void pidff_set_autocenter(struct input_dev *dev, u16 magnitude)
- static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
-                            struct hid_report *report, int count, int strict)
+@@ -772,6 +772,11 @@ static int pidff_find_fields(struct pidf
  {
+       int i, j, k, found;
 +      if (!report) {
 +              pr_debug("pidff_find_fields, null report\n");
 +              return -1;
 +      }
 +
-       int i, j, k, found;
        for (k = 0; k < count; k++) {
-@@ -883,6 +888,11 @@ static int pidff_reports_ok(struct pidff_device *pidff)
- static struct hid_field *pidff_find_special_field(struct hid_report *report,
-                                                 int usage, int enforce_min)
+               found = 0;
+               for (i = 0; i < report->maxfield; i++) {
+@@ -885,6 +890,11 @@ static struct hid_field *pidff_find_spec
  {
+       int i;
 +      if (!report) {
 +              pr_debug("pidff_find_special_field, null report\n");
 +              return NULL;
 +      }
 +
-       int i;
        for (i = 0; i < report->maxfield; i++) {
--- 
-2.39.5
-
+               if (report->field[i]->logical == (HID_UP_PID | usage) &&
+                   report->field[i]->report_count > 0) {
index ffa17e63356d6d5d7db7198b334732e851782fff..59375847a1b220d387592ecdc1ea36724f1153a5 100644 (file)
@@ -31,38 +31,34 @@ Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
 Tested-by: Pablo Cisneros <patchkez@protonmail.com>
 Signed-off-by: Jiri Kosina <jkosina@suse.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/hid/usbhid/hid-pidff.c | 10 ++++++++++
+ drivers/hid/usbhid/hid-pidff.c |   10 ++++++++++
  1 file changed, 10 insertions(+)
 
-diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
-index a01c1b2ab2f4c..26cb331b646ca 100644
 --- a/drivers/hid/usbhid/hid-pidff.c
 +++ b/drivers/hid/usbhid/hid-pidff.c
-@@ -770,6 +770,11 @@ static void pidff_set_autocenter(struct input_dev *dev, u16 magnitude)
- static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
-                            struct hid_report *report, int count, int strict)
+@@ -772,6 +772,11 @@ static int pidff_find_fields(struct pidf
  {
+       int i, j, k, found;
 +      if (!report) {
 +              pr_debug("pidff_find_fields, null report\n");
 +              return -1;
 +      }
 +
-       int i, j, k, found;
        for (k = 0; k < count; k++) {
-@@ -883,6 +888,11 @@ static int pidff_reports_ok(struct pidff_device *pidff)
- static struct hid_field *pidff_find_special_field(struct hid_report *report,
-                                                 int usage, int enforce_min)
+               found = 0;
+               for (i = 0; i < report->maxfield; i++) {
+@@ -885,6 +890,11 @@ static struct hid_field *pidff_find_spec
  {
+       int i;
 +      if (!report) {
 +              pr_debug("pidff_find_special_field, null report\n");
 +              return NULL;
 +      }
 +
-       int i;
        for (i = 0; i < report->maxfield; i++) {
--- 
-2.39.5
-
+               if (report->field[i]->logical == (HID_UP_PID | usage) &&
+                   report->field[i]->report_count > 0) {
index 7419de65dc00567eefde623b69b649d845542155..6a8c39789ac251def0ee5caeb647d5eefd515bcc 100644 (file)
@@ -31,38 +31,34 @@ Tested-by: Cristóferson Bueno <cbueno81@gmail.com>
 Tested-by: Pablo Cisneros <patchkez@protonmail.com>
 Signed-off-by: Jiri Kosina <jkosina@suse.com>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/hid/usbhid/hid-pidff.c | 10 ++++++++++
+ drivers/hid/usbhid/hid-pidff.c |   10 ++++++++++
  1 file changed, 10 insertions(+)
 
-diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
-index ba0d7cb15377e..7801294fe086d 100644
 --- a/drivers/hid/usbhid/hid-pidff.c
 +++ b/drivers/hid/usbhid/hid-pidff.c
-@@ -770,6 +770,11 @@ static void pidff_set_autocenter(struct input_dev *dev, u16 magnitude)
- static int pidff_find_fields(struct pidff_usage *usage, const u8 *table,
-                            struct hid_report *report, int count, int strict)
+@@ -772,6 +772,11 @@ static int pidff_find_fields(struct pidf
  {
+       int i, j, k, found;
 +      if (!report) {
 +              pr_debug("pidff_find_fields, null report\n");
 +              return -1;
 +      }
 +
-       int i, j, k, found;
        for (k = 0; k < count; k++) {
-@@ -883,6 +888,11 @@ static int pidff_reports_ok(struct pidff_device *pidff)
- static struct hid_field *pidff_find_special_field(struct hid_report *report,
-                                                 int usage, int enforce_min)
+               found = 0;
+               for (i = 0; i < report->maxfield; i++) {
+@@ -885,6 +890,11 @@ static struct hid_field *pidff_find_spec
  {
+       int i;
 +      if (!report) {
 +              pr_debug("pidff_find_special_field, null report\n");
 +              return NULL;
 +      }
 +
-       int i;
        for (i = 0; i < report->maxfield; i++) {
--- 
-2.39.5
-
+               if (report->field[i]->logical == (HID_UP_PID | usage) &&
+                   report->field[i]->report_count > 0) {