From ae41244d4e302caf6f64f458cbf447e99b12966a Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 20 Apr 2021 19:46:41 +0800 Subject: [PATCH] ipmi_si_intf: Fix race in timer shutdown handling mainline inclusion from mainline-5.4 commit c9acc3c4f8e42ae538aea7f418fddc16f257ba75 category: bugfix bugzilla: NA CVE: NA ------------------------------------------------- smi_mod_timer() enables the timer before setting timer_running. This means the timer can be running when we get to stop_timer_and_thread() without timer_running having been set, resulting in del_timer_sync() not being called and the timer being left to cause havoc during shutdown. Instead just call del_timer_sync() unconditionally Signed-off-by: Jes Sorensen Message-Id: <20190828203625.32093-2-Jes.Sorensen@gmail.com> Signed-off-by: Corey Minyard Signed-off-by: Wenchao Hao Reviewed-by: Miaohe Lin Signed-off-by: Yang Yingliang --- drivers/char/ipmi/ipmi_si_intf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index ba330380e5da..17d706fdac76 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1845,8 +1845,7 @@ static inline void stop_timer_and_thread(struct smi_info *smi_info) } smi_info->timer_can_start = false; - if (smi_info->timer_running) - del_timer_sync(&smi_info->si_timer); + del_timer_sync(&smi_info->si_timer); } static struct smi_info *find_dup_si(struct smi_info *info) -- GitLab