linux-stable/drivers/usb
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
..
atm usb: move from strlcpy with unused retval to strscpy 2022-08-19 11:08:54 +02:00
c67x00
cdns3 usb: cdnsp: fix lack of ZLP for ep0 2022-11-29 08:56:09 +01:00
chipidea Merge 6.1-rc6 into usb-next 2022-11-21 10:37:10 +01:00
class USB: make devnode() callback in usb_class_driver take a const * 2022-10-20 12:11:56 +02:00
common usb: ulpi: defer ulpi_register on ulpi_read_id timeout 2022-12-08 16:48:07 +01:00
core Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
dwc2 usb: dwc2: power on/off phy for peripheral mode in dual-role mode 2022-12-08 16:50:56 +01:00
dwc3 usb: dwc3: core: defer probe on ulpi_read_id timeout 2022-12-08 16:48:07 +01:00
early usb: early: xhci-dbc: use console_is_registered() 2022-12-02 11:25:02 +01:00
fotg210 usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe() 2022-12-08 16:45:58 +01:00
gadget treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
host USB/Thunderbolt driver changes for 6.2-rc1 2022-12-16 03:22:53 -08:00
image usb/image: fix repeated words in comments 2022-07-27 14:33:53 +02:00
isp1760
misc Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
mon usb: mon: make mmapped memory read only 2022-09-22 15:52:29 +02:00
mtu3 usb: mtu3: fix failed runtime suspend in host only mode 2022-09-30 13:55:48 +02:00
musb usb: musb: remove extra check in musb_gadget_vbus_draw 2022-12-08 16:44:39 +01:00
phy usb: isp1301-omap: Convert to i2c's .probe_new() 2022-11-22 17:33:27 +01:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-06-21 16:39:03 +02:00
roles Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
serial treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
storage usb: storage: Add check for kcalloc 2022-12-08 16:43:12 +01:00
typec Driver Core changes for 6.2-rc1 2022-12-16 03:54:54 -08:00
usbip Including fixes from bpf, netfilter and can. 2022-12-21 08:41:32 -08:00
Kconfig usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
Makefile usb: fotg210: Collect pieces of dual mode controller 2022-11-09 12:38:09 +01:00
usb-skeleton.c usb: add usb_set_intfdata() documentation 2022-11-29 08:56:09 +01:00