Skip to content

Commit ad99807

Browse files
bluesheep1337gregkh
authored andcommitted
media: dm1105: Fix use after free bug in dm1105_remove due to race condition
[ Upstream commit 5abda7a ] In dm1105_probe, it called dm1105_ir_init and bound &dm1105->ir.work with dm1105_emit_key. When it handles IRQ request with dm1105_irq, it may call schedule_work to start the work. When we call dm1105_remove to remove the driver, there may be a sequence as follows: Fix it by finishing the work before cleanup in dm1105_remove CPU0 CPU1 |dm1105_emit_key dm1105_remove | dm1105_ir_exit | rc_unregister_device | rc_free_device | rc_dev_release | kfree(dev); | | | rc_keydown | //use Fixes: 34d2f9b ("V4L/DVB: dm1105: use dm1105_dev & dev instead of dm1105dvb") Signed-off-by: Zheng Wang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 680aedf commit ad99807

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/media/pci/dm1105/dm1105.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ static void dm1105_remove(struct pci_dev *pdev)
11761176
struct dvb_demux *dvbdemux = &dev->demux;
11771177
struct dmx_demux *dmx = &dvbdemux->dmx;
11781178

1179+
cancel_work_sync(&dev->ir.work);
11791180
dm1105_ir_exit(dev);
11801181
dmx->close(dmx);
11811182
dvb_net_release(&dev->dvbnet);

0 commit comments

Comments
 (0)