WSL2-Linux-Kernel/fs/nilfs2
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
..
Kconfig
Makefile
alloc.c
alloc.h
bmap.c
bmap.h
btnode.c
btnode.h
btree.c nilfs2: delete unnecessary checks before brelse() 2022-10-03 14:21:44 -07:00
btree.h
cpfile.c
cpfile.h
dat.c nilfs2: fix NULL pointer dereference in nilfs_palloc_commit_free_entry() 2022-11-30 14:49:40 -08:00
dat.h
dir.c
direct.c
direct.h
export.h
file.c
gcinode.c
ifile.c
ifile.h
inode.c nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level() 2022-10-11 19:05:45 -07:00
ioctl.c
mdt.c
mdt.h
namei.c
nilfs.h
page.c nilfs2: convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig() 2022-09-11 20:26:03 -07:00
page.h
recovery.c
segbuf.c
segbuf.h
segment.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
segment.h
sufile.c nilfs2: fix nilfs_sufile_mark_dirty() not set segment usage as dirty 2022-11-22 18:50:45 -08:00
sufile.h
super.c nilfs2: fix use-after-free bug of ns_writer on remount 2022-11-08 15:57:24 -08:00
sysfs.c
sysfs.h
the_nilfs.c Non-MM patches for 6.2-rc1. 2022-12-12 17:28:58 -08:00
the_nilfs.h