media: rc: oops in ir_timer_keyup after device unplug
authorSean Young <sean@mess.org>
Tue, 6 Mar 2018 13:57:57 +0000 (08:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jul 2018 12:28:48 +0000 (14:28 +0200)
commit 8d4068810d9926250dd2435719a080b889eb44c3 upstream.

If there is IR in the raw kfifo when ir_raw_event_unregister() is called,
then kthread_stop() causes ir_raw_event_thread to be scheduled, decode
some scancodes and re-arm timer_keyup. The timer_keyup then fires when
the rc device is long gone.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/rc/rc-main.c

index 72f381522cb26dfa64662ab0b6a4f61adc91a11c..a22828713c1cab4c481a09e7d1f507f4b6347949 100644 (file)
@@ -1824,11 +1824,11 @@ void rc_unregister_device(struct rc_dev *dev)
        if (!dev)
                return;
 
-       del_timer_sync(&dev->timer_keyup);
-
        if (dev->driver_type == RC_DRIVER_IR_RAW)
                ir_raw_event_unregister(dev);
 
+       del_timer_sync(&dev->timer_keyup);
+
        rc_free_rx_device(dev);
 
        device_del(&dev->dev);