dvb_usbv2_remote_init() initializes d->rc_query_work only when the driver asks for IR polling, that is, when rc.query is set and bulk mode is not used. dvb_usbv2_remote_exit() however cancels that work whenever an rc device was registered. Drivers which register an rc device but decode IR in their own interrupt handler, for example lmedm04, never set rc.query, so the delayed work stays zeroed and cancel_delayed_work_sync() trips the flush_work() sanity check every time the device is disconnected: WARNING: kernel/workqueue.c:4409 at __flush_work+0x8ed/0xaf0 ... cancel_delayed_work_sync dvb_usbv2_remote_exit dvb_usbv2_exit dvb_usbv2_disconnect usb_unbind_interface ... The same condition, d->rc_polling_active, is set when the work is initialized and scheduled and is already used by dvb_usbv2_suspend() and dvb_usbv2_resume_common() to stop and restart polling. Use it to guard the cancellation as well. Fixes: 05752890411c ("[media] dvb_usb_v2: remote controller changes") Cc: stable@vger.kernel.org Co-developed-by: Bin Yu Signed-off-by: Bin Yu Co-developed-by: Cheng Wen Signed-off-by: Cheng Wen Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> --- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index bd86d250433d..c714b37169d6 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -185,7 +185,8 @@ static int dvb_usbv2_remote_exit(struct dvb_usb_device *d) dev_dbg(&d->udev->dev, "%s:\n", __func__); if (d->rc_dev) { - cancel_delayed_work_sync(&d->rc_query_work); + if (d->rc_polling_active) + cancel_delayed_work_sync(&d->rc_query_work); rc_unregister_device(d->rc_dev); rc_free_device(d->rc_dev); d->rc_dev = NULL; -- 2.34.1