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
..
2022-12-23 11:39:18 -08:00
2022-12-22 11:40:35 +00:00
2022-12-14 12:20:00 -08:00
2022-12-13 10:43:59 -08:00
2022-12-12 20:14:04 -08:00
2022-12-15 18:14:21 -08:00
\n
2022-12-12 20:32:50 -08:00
2022-12-14 15:27:57 -08:00
2022-12-13 19:29:45 -08:00
2022-12-13 19:29:45 -08:00
2022-12-17 08:18:04 -06:00
2022-12-13 19:29:45 -08:00
2022-12-13 19:29:45 -08:00
2022-12-11 18:12:18 -08:00
2022-12-14 10:11:51 -08:00
2022-10-20 10:13:27 +02:00
2022-12-13 19:29:45 -08:00
2022-12-15 09:29:19 -08:00
2022-12-12 20:54:39 -08:00
2022-09-24 07:00:00 +02:00
2022-12-16 03:54:54 -08:00
2022-12-19 09:10:33 -06:00
2022-12-21 10:18:17 -08:00
2022-12-11 18:12:18 -08:00
2022-12-12 20:18:26 -08:00
2022-12-15 11:12:21 -08:00
2022-12-23 11:55:54 -08:00
2022-10-10 19:45:17 -07:00
2022-12-13 09:47:48 -08:00
2022-05-09 16:21:46 -04:00
2022-12-12 20:24:51 -08:00
\n
2022-12-12 20:32:50 -08:00
2022-09-11 20:26:07 -07:00
2022-12-14 10:11:51 -08:00
2022-11-25 17:01:22 +09:00
2022-10-20 10:13:27 +02:00
2022-12-14 12:20:00 -08:00
2022-08-20 11:34:33 -04:00
2022-12-11 18:12:17 -08:00
2022-10-10 19:45:17 -07:00
2022-12-12 19:20:05 -08:00
2022-12-15 18:09:48 -08:00
2022-12-12 19:20:05 -08:00
2022-12-12 19:03:10 -08:00
2022-04-01 19:35:56 -07:00
2022-10-10 14:21:11 -07:00
2022-08-03 10:35:43 -07:00
2022-12-13 09:14:50 -08:00
2022-12-12 19:30:18 -08:00
2022-12-13 09:14:50 -08:00
2022-12-21 14:45:25 +01:00
2022-12-12 19:30:18 -08:00
2022-06-28 13:58:05 -04:00
2022-12-13 10:26:38 -08:00
2022-10-26 10:02:34 +02:00
2022-12-12 18:38:47 -08:00