tty: ipwireless: shut down setup timer before freeing hardware
Subsystems (2)
PATCH 1/1 tty: ipwireless: shut down setup timer before freeing hardware
ipwireless_stop_interrupts() uses timer_delete() for a timer whose callback can rearm itself. timer_delete() neither waits for a running callback nor prevents that callback from rearming the timer. The callback can therefore continue to access struct ipw_hardware after ipwireless_hardware_free() has freed it.
Use timer_shutdown_sync() so teardown waits for the callback and prevents any further rearming.
--- drivers/tty/ipwireless/hardware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/ipwireless/hardware.c +1 -1
@@ -1721,7 +1721,7 @@ void ipwireless_stop_interrupts(struct ipw_hardware *hw)if (!hw->shutting_down) {/* Tell everyone we are going down. */ hw->shutting_down =1 ; -timer_delete (&hw->setup_timer); +timer_shutdown_sync (&hw->setup_timer);/* Prevent the hardware from sending any more interrupts */ do_close_hardware (hw);
Signature · 1 line
2.50.1.windows.1
Greg Kroah-Hartman
maintainerQuoted 32 lines · Hongyan Xu
ipwireless_stop_interrupts()usestimer_delete()for a timer whose callback can rearm itself.timer_delete()neither waits for a running callback nor prevents that callback from rearming the timer. The callback can therefore continue to access structipw_hardwareafteripwireless_hardware_free()has freed it.Use
timer_shutdown_sync()so teardown waits for the callback and prevents any further rearming.Fixes 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")Signed-off-by Hongyan Xu <[email protected]>--- drivers/tty/ipwireless/hardware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/ipwireless/hardware.c +1
-1@@ -1721,7 +1721,7 @@ void ipwireless_stop_interrupts(struct ipw_hardware *hw)if (!hw->shutting_down) {/* Tell everyone we are going down. */ hw->shutting_down =1 ; -timer_delete (&hw->setup_timer); +timer_shutdown_sync (&hw->setup_timer);/* Prevent the hardware from sending any more interrupts */ do_close_hardware (hw);Signature · 1 line
2.50.1.windows.1
How was this tested?
Quoted 21 lines · Hongyan Xu
ipwireless_stop_interrupts()usestimer_delete()for a timer whose callback can rearm itself.timer_delete()neither waits for a running callback nor prevents that callback from rearming the timer. The callback can therefore continue to access structipw_hardwareafteripwireless_hardware_free()has freed it.Use
timer_shutdown_sync()so teardown waits for the callback and prevents any further rearming.Fixes 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")Signed-off-by Hongyan Xu <[email protected]>--- drivers/tty/ipwireless/hardware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/ipwireless/hardware.c +0
-0
drivers/tty/ipwireless/hardware.c void ipwireless_stop_interrupts(struct ipw_hardware *hw) · line 1727
Quoted 8 lines
drivers/tty/ipwireless/hardware.c +1
-1@@ -1721,7 +1721,7 @@ void ipwireless_stop_interrupts(struct ipw_hardware *hw)if (!hw->shutting_down) {/* Tell everyone we are going down. */ hw->shutting_down =1 ; -timer_delete (&hw->setup_timer); +timer_shutdown_sync (&hw->setup_timer);/* Prevent the hardware from sending any more interrupts */ do_close_hardware (hw);
The driver is queued for removal.
Signature · 2 lines
Jiri Kosina SUSE Labs