OSDN Git Service

HID: bigbenff: prevent null pointer dereference
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 2 Dec 2021 09:53:32 +0000 (10:53 +0100)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 2 Dec 2021 14:36:18 +0000 (15:36 +0100)
When emulating the device through uhid, there is a chance we don't have
output reports and so report_field is null.

Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211202095334.14399-3-benjamin.tissoires@redhat.com
drivers/hid/hid-bigbenff.c

index db6da21..74ad8bf 100644 (file)
@@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work)
                struct bigben_device, worker);
        struct hid_field *report_field = bigben->report->field[0];
 
-       if (bigben->removed)
+       if (bigben->removed || !report_field)
                return;
 
        if (bigben->work_led) {