Skip to content

Commit 3f4093e

Browse files
stonezdmkuba-moo
authored andcommitted
atm: idt77252: fix use-after-free bugs caused by tst_timer
There are use-after-free bugs caused by tst_timer. The root cause is that there are no functions to stop tst_timer in idt77252_exit(). One of the possible race conditions is shown below: (thread 1) | (thread 2) | idt77252_init_one | init_card | fill_tst | mod_timer(&card->tst_timer, ...) idt77252_exit | (wait a time) | tst_timer | | ... kfree(card) // FREE | | card->soft_tst[e] // USE The idt77252_dev is deallocated in idt77252_exit() and used in timer handler. This patch adds del_timer_sync() in idt77252_exit() in order that the timer handler could be stopped before the idt77252_dev is deallocated. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Link: https://lore.kernel.org/r/20220805070008.18007-1-duoming@zju.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 7e4babf commit 3f4093e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/atm/idt77252.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,6 +3752,7 @@ static void __exit idt77252_exit(void)
37523752
card = idt77252_chain;
37533753
dev = card->atmdev;
37543754
idt77252_chain = card->next;
3755+
del_timer_sync(&card->tst_timer);
37553756

37563757
if (dev->phy->stop)
37573758
dev->phy->stop(dev);

0 commit comments

Comments
 (0)