linux/drivers/net
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
..
appletalk
arcnet arcnet: fix potential memory leak in com20020_probe() 2022-11-23 12:41:54 +00:00
bonding bonding: do failover when high prio link up 2022-12-13 19:19:32 -08:00
caif
can can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len 2022-12-19 16:08:27 +01:00
dsa net: dsa: microchip: remove IRQF_TRIGGER_FALLING in request_threaded_irq 2022-12-19 17:18:48 -08:00
ethernet treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
fddi net: defxx: Fix missing err handling in dfx_init() 2022-12-09 10:44:27 +00:00
fjes ACPI: make remove callback of ACPI driver void 2022-11-23 19:11:22 +01:00
hamradio Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-13 09:49:29 +01:00
hippi
hyperv
ieee802154 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00
ipa net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
ipvlan Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
mctp mctp: serial: Fix starting value for frame check sequence 2022-12-19 12:38:45 +00:00
mdio net: mdio: fix unbalanced fwnode reference count in mdio_device_release() 2022-12-06 12:50:00 +01:00
netdevsim xfrm: allow state packet offload mode 2022-12-05 10:32:44 +01:00
pcs net: pcs: altera-tse: remove unnecessary register definitions 2022-11-29 20:29:55 -08:00
phy Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
plip net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() 2022-12-07 20:10:47 -08:00
ppp Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
pse-pd
slip
team Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
usb treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
vmxnet3 vmxnet3: use correct intrConf reference when using extended queues 2022-12-02 10:30:07 +00:00
vxlan
wan net: farsync: Fix kmemleak when rmmods farsync 2022-12-12 09:42:45 +00:00
wireguard wireguard: timers: cast enum limits members to int in prints 2022-12-13 19:30:45 -08:00
wireless treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
wwan Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00
xen-netback xen/netback: fix build warning 2022-12-07 16:03:21 +01:00
amt.c
bareudp.c
dummy.c ethtool: doc: clarify what drivers can implement in their get_drvinfo() 2022-11-17 19:26:02 -08:00
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-29 13:04:52 -08:00
macsec.c net: macsec: fix net device access prior to holding a lock 2022-12-13 18:58:08 -08:00
macvlan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
macvtap.c driver core: class: make namespace and get_ownership take const * 2022-11-09 15:49:32 +01:00
Makefile
mdio.c
mhi_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-17 18:30:39 -08:00
mii.c
net_failover.c
netconsole.c netconsole: avoid CON_ENABLED misuse to track registration 2022-12-02 11:25:02 +01:00
nlmon.c
ntb_netdev.c ntb_netdev: Use dev_kfree_skb_any() in interrupt context 2022-12-12 12:56:37 -08:00
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c driver/net/tun: Added features for USO. 2022-12-12 09:29:56 +00:00
thunderbolt.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00
tun.c driver/net/tun: Added features for USO. 2022-12-12 09:29:56 +00:00
veth.c Revert "veth: Avoid drop packets when xdp_redirect performs" 2022-11-22 20:42:08 -08:00
virtio_net.c drivers/net/virtio_net.c: Added USO support. 2022-12-12 09:29:56 +00:00
vrf.c
vsockmon.c
xen-netfront.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00