]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "HID: Increase maximum report size allowed by hid_field_extract()"
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 5 Jun 2019 12:44:05 +0000 (14:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jun 2019 05:59:59 +0000 (07:59 +0200)
commit 15fc1b5c86128f91c8c6699c3b0d9615740b13f1 upstream.

This reverts commit 94a9992f7dbdfb28976b565af220e0c4a117144a.

The commit allows for more than 32 bits in hid_field_extract(),
but the return value is a 32 bits int.
So basically what this commit is doing is just silencing those
legitimate errors.

Revert to a previous situation in the hope that a proper
fix will be impletemented.

Fixes: 94a9992f7dbd ("HID: Increase maximum report size allowed by hid_field_extract()")
Cc: stable@vger.kernel.org # v5.1
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-core.c

index f4de4af522d5c6be16ba13a69cec26b6ec776f17..39eba8106d40b78c2c2c7971df52c5d98d7f4e3e 100644 (file)
@@ -1313,10 +1313,10 @@ static u32 __extract(u8 *report, unsigned offset, int n)
 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
                        unsigned offset, unsigned n)
 {
-       if (n > 256) {
-               hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n",
+       if (n > 32) {
+               hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
                         n, current->comm);
-               n = 256;
+               n = 32;
        }
 
        return __extract(report, offset, n);