media: imon: fix timer racing disconnect
authorOliver Neukum <oneukum@suse.com>
Thu, 28 Apr 2022 13:34:54 +0000 (15:34 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:02:22 +0000 (11:02 +0200)
The timer will report events for an input device.
Reporting events for an unregistered device is bad.
Hence the timer must be killed first.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/rc/imon.c

index 761b7fa..8dbeab4 100644 (file)
@@ -2537,8 +2537,8 @@ static void imon_disconnect(struct usb_interface *interface)
                usb_kill_urb(ictx->rx_urb_intf1);
                usb_put_dev(ictx->usbdev_intf1);
                if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) {
-                       input_unregister_device(ictx->touch);
                        del_timer_sync(&ictx->ttimer);
+                       input_unregister_device(ictx->touch);
                }
        }