atm: idt77252: fix use-after-free bugs caused by tst_timer
Duoming Zhou authored
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: 1da177e4

 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220805070008.18007-1-duoming@zju.edu.cn

Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
3f4093e2
Name Last commit Last update
..
.gitignore .gitignore: add SPDX License Identifier
Kconfig net: atm: remove support for ZeitNet ZN122x ATM devices
Makefile net: atm: remove support for ZeitNet ZN122x ATM devices
adummy.c treewide: Add SPDX license identifier for more missed files
atmtcp.c atm: atmtcp: Constify atmtcp_v_dev_ops
eni.c atm: eni: Add check for dma_map_single
eni.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
fore200e.c atm: fore200e: Fix fall-through warnings for Clang
fore200e.h fore200e: devirtualize dma alloc calls
he.c atm: he: Use the bitmap API to allocate bitmaps
he.h atm: remove deprecated use of pci api
idt77105.c atm: idt77252: fix null-ptr-dereference
idt77105.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
idt77252.c atm: idt77252: fix use-after-free bugs caused by tst_timer
idt77252.h atm: idt77252: fix build broken on amd64
idt77252_tables.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
iphase.c atm: iphase: Fix typo in comment
iphase.h atm: Replace custom isprint() with generic analogue
lanai.c atm: lanai: dont run lanai_dev_close if not open
midway.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
nicstar.c atm: nicstar: Use kcalloc() to simplify code
nicstar.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
nicstarmac.c net: remove comments that mention obsolete __SLOW_DOWN_IO
nicstarmac.copyright drivers/atm/: remove CVS keywords
solos-attrlist.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license
solos-pci.c net/atm: remove the atmdev_ops {get, set}sockopt methods
suni.c atm: delete include/linux/atm_suni.h
suni.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
tonga.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license
zeprom.h atm: Fix typo