summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNagamani PV <nagamani@linux.ibm.com>2026-09-30 09:02:33 +0200
committerJakub Kicinski <kuba@kernel.org>2026-10-05 17:26:53 -0700
commit10c339aff290684dc424ca6b6eed5579569ee781 (patch)
tree36ab83d5c11b1cae296edc03c6513d1c1c85e1f0
parent363cf8def36201fa6bbca6b2b9f87b32340eba01 (diff)
s390/ctcm: Fix timer corruption in fsm_addtimer()
fsm_addtimer() calls timer_setup() unconditionally before add_timer(). If called on an already-pending timer, timer_setup() re-initializes the timer's list_head fields while the timer is still enqueued in the wheel, corrupting the timer list. The timer is already initialized once by fsm_settimer() which calls timer_setup() correctly. Multiple callsites invoke fsm_addtimer() without a preceding fsm_deltimer(), including ctcm_main.c ctcmpc_send_sweep_req() and ctcm_mpc.c mpc_action_side_xid(), making the redundant timer_setup() in fsm_addtimer() a real corruption risk. Remove the redundant timer_setup() calls from fsm_addtimer() and fsm_modtimer(), and replace add_timer() with mod_timer() which safely handles both pending and non-pending timers atomically without corrupting the timer wheel. Cc: stable+noautosel@kernel.org # never worked Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://sashiko.dev/#/patchset/20260803182736.2356374-1-nagamani@linux.ibm.com?part=1 Reviewed-by: Aswin Karuvally <aswin@linux.ibm.com> Tested-by: Aswin Karuvally <aswin@linux.ibm.com> Signed-off-by: Nagamani PV <nagamani@linux.ibm.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260930070234.569500-2-nagamani@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/s390/net/fsm.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c
index 9b8622aef807..936ed0bc8401 100644
--- a/drivers/s390/net/fsm.c
+++ b/drivers/s390/net/fsm.c
@@ -171,11 +171,9 @@ fsm_addtimer(fsm_timer *this, int millisec, int event, void *arg)
this->fi->name, this, millisec);
#endif
- timer_setup(&this->tl, fsm_expire_timer, 0);
this->expire_event = event;
this->event_arg = arg;
- this->tl.expires = jiffies + (millisec * HZ) / 1000;
- add_timer(&this->tl);
+ mod_timer(&this->tl, jiffies + msecs_to_jiffies(millisec));
return 0;
}
@@ -189,12 +187,9 @@ fsm_modtimer(fsm_timer *this, int millisec, int event, void *arg)
this->fi->name, this, millisec);
#endif
- timer_delete(&this->tl);
- timer_setup(&this->tl, fsm_expire_timer, 0);
this->expire_event = event;
this->event_arg = arg;
- this->tl.expires = jiffies + (millisec * HZ) / 1000;
- add_timer(&this->tl);
+ mod_timer(&this->tl, jiffies + msecs_to_jiffies(millisec));
}
EXPORT_SYMBOL(init_fsm);