linux/drivers/staging
Steven Rostedt (Google) 292a089d78 treewide: Convert del_timer*() to timer_shutdown*()
Due to several bugs caused by timers being re-armed after they are
shutdown and just before they are freed, a new state of timers was added
called "shutdown".  After a timer is set to this state, then it can no
longer be re-armed.

The following script was run to find all the trivial locations where
del_timer() or del_timer_sync() is called in the same function that the
object holding the timer is freed.  It also ignores any locations where
the timer->function is modified between the del_timer*() and the free(),
as that is not considered a "trivial" case.

This was created by using a coccinelle script and the following
commands:

    $ cat timer.cocci
    @@
    expression ptr, slab;
    identifier timer, rfield;
    @@
    (
    -       del_timer(&ptr->timer);
    +       timer_shutdown(&ptr->timer);
    |
    -       del_timer_sync(&ptr->timer);
    +       timer_shutdown_sync(&ptr->timer);
    )
      ... when strict
          when != ptr->timer
    (
            kfree_rcu(ptr, rfield);
    |
            kmem_cache_free(slab, ptr);
    |
            kfree(ptr);
    )

    $ spatch timer.cocci . > /tmp/t.patch
    $ patch -p1 < /tmp/t.patch

Link: https://lore.kernel.org/lkml/20221123201306.823305113@linutronix.de/
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Pavel Machek <pavel@ucw.cz> [ LED ]
Acked-by: Kalle Valo <kvalo@kernel.org> [ wireless ]
Acked-by: Paolo Abeni <pabeni@redhat.com> [ networking ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-12-25 13:38:09 -08:00
..
axis-fifo
board
emxx_udc staging: emxx_udc: use min helper macro for variable comparison 2022-11-08 16:26:58 +01:00
fbtft
fieldbus staging: fieldbus: use sysfs_emit() in show functions 2022-11-09 14:40:13 +01:00
gdm724x staging: gdm724x: Replace macro GDM_TTY_READY with static inline function 2022-11-22 13:20:16 +01:00
greybus staging: greybus: loopback_test: Remove extra blank lines 2022-12-05 13:28:41 +01:00
iio staging: iio: accel: adis16240: Call '__adis_initial_startup()' 2022-11-23 20:37:51 +00:00
ks7010 staging: ks7010: Avoid clashing function prototypes 2022-11-09 14:39:03 +01:00
media treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
most staging: most: i2c: Convert to i2c's .probe_new() 2022-11-22 13:23:25 +01:00
nvec
octeon staging: octeon: cvmx_ptr_to_phys() should return physaddr_t 2022-11-02 08:21:49 +01:00
olpc_dcon staging: olpc_dcon: Convert to i2c's .probe_new() 2022-11-22 13:23:25 +01:00
pi433 staging: pi433: overlay: Rename overlay source file from .dts to .dtso 2022-10-26 09:08:02 -05:00
qlge
r8188eu staging: r8188eu: use subtype helper in rtw_check_bcn_info 2022-12-05 13:29:32 +01:00
rtl8192e Staging driver changes for 6.2-rc1 2022-12-16 03:27:03 -08:00
rtl8192u staging: rtl8192u: Fix use after free in ieee80211_rx() 2022-12-05 13:24:50 +01:00
rtl8712 staging: rtl8712: fix potential memory leak 2022-10-31 09:08:30 +01:00
rtl8723bs staging: rtl8723bs: replace underutilized struct by array variable 2022-11-08 16:26:49 +01:00
rts5208
sm750fb Staging driver changes for 6.2-rc1 2022-12-16 03:27:03 -08:00
vc04_services vc04_services: bcm2835-camera: Use bool values for mmal_fmt.remove_padding 2022-11-22 13:20:21 +01:00
vme_user vme: Use root_device_register() not underlined version 2022-12-08 17:00:18 +01:00
vt6655 Staging driver changes for 6.2-rc1 2022-12-16 03:27:03 -08:00
vt6656
wlan-ng treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
Kconfig
Makefile