mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 11:10:18 +01:00
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>
|
||
|---|---|---|
| .. | ||
| acpica | ||
| apei | ||
| arm64 | ||
| dptf | ||
| nfit | ||
| numa | ||
| pmic | ||
| x86 | ||
| ac.c | ||
| acpi_adxl.c | ||
| acpi_amba.c | ||
| acpi_apd.c | ||
| acpi_cmos_rtc.c | ||
| acpi_configfs.c | ||
| acpi_dbg.c | ||
| acpi_extlog.c | ||
| acpi_ffh.c | ||
| acpi_fpdt.c | ||
| acpi_ipmi.c | ||
| acpi_lpat.c | ||
| acpi_lpit.c | ||
| acpi_lpss.c | ||
| acpi_memhotplug.c | ||
| acpi_pad.c | ||
| acpi_pcc.c | ||
| acpi_platform.c | ||
| acpi_pnp.c | ||
| acpi_processor.c | ||
| acpi_tad.c | ||
| acpi_video.c | ||
| acpi_watchdog.c | ||
| battery.c | ||
| bgrt.c | ||
| blacklist.c | ||
| bus.c | ||
| button.c | ||
| container.c | ||
| cppc_acpi.c | ||
| custom_method.c | ||
| debugfs.c | ||
| device_pm.c | ||
| device_sysfs.c | ||
| dock.c | ||
| ec_sys.c | ||
| ec.c | ||
| event.c | ||
| evged.c | ||
| fan_attr.c | ||
| fan_core.c | ||
| fan.h | ||
| glue.c | ||
| hed.c | ||
| internal.h | ||
| ioapic.c | ||
| irq.c | ||
| Kconfig | ||
| Makefile | ||
| nvs.c | ||
| osi.c | ||
| osl.c | ||
| pci_irq.c | ||
| pci_link.c | ||
| pci_mcfg.c | ||
| pci_root.c | ||
| pci_slot.c | ||
| pfr_telemetry.c | ||
| pfr_update.c | ||
| platform_profile.c | ||
| power.c | ||
| pptt.c | ||
| prmt.c | ||
| proc.c | ||
| processor_core.c | ||
| processor_driver.c | ||
| processor_idle.c | ||
| processor_pdc.c | ||
| processor_perflib.c | ||
| processor_thermal.c | ||
| processor_throttling.c | ||
| property.c | ||
| reboot.c | ||
| resource.c | ||
| sbs.c | ||
| sbshc.c | ||
| sbshc.h | ||
| scan.c | ||
| sleep.c | ||
| sleep.h | ||
| spcr.c | ||
| sysfs.c | ||
| tables.c | ||
| thermal.c | ||
| tiny-power-button.c | ||
| utils.c | ||
| video_detect.c | ||
| viot.c | ||
| wakeup.c | ||