Message ID | 20230602145323.697951-2-thibault.ferrante@canonical.com |
---|---|
State | New |
Headers | show |
Series | CVE-2022-3635 | expand |
On 02/06/2023 16:53, Thibault Ferrante wrote: > From: Duoming Zhou <duoming@zju.edu.cn> > > 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: 1da177e4c3f4 ("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> There are 3 things missing here: 1. (cherry-picked from commit <commit>) I recommend using -x when you use git cherry-pick. 2. CVE number 3. Your SOB (option -s is useful too) Ex: (cherry-picked from commit 3f4093e2bf4673f218c0bf17d8362337c400e77b (If I am not mistaken) CVE-2022-3635 Signed-off-by: Thibault Ferrante <thibault.ferrante@canonical.com> > --- > drivers/atm/idt77252.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c > index 81ce81a75fc6..681cb3786794 100644 > --- a/drivers/atm/idt77252.c > +++ b/drivers/atm/idt77252.c > @@ -3752,6 +3752,7 @@ static void __exit idt77252_exit(void) > card = idt77252_chain; > dev = card->atmdev; > idt77252_chain = card->next; > + del_timer_sync(&card->tst_timer); > > if (dev->phy->stop) > dev->phy->stop(dev); Hi, I gave some feedback inline. Roxana
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 81ce81a75fc6..681cb3786794 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -3752,6 +3752,7 @@ static void __exit idt77252_exit(void) card = idt77252_chain; dev = card->atmdev; idt77252_chain = card->next; + del_timer_sync(&card->tst_timer); if (dev->phy->stop) dev->phy->stop(dev);