[RFC,v2,10/31] timers: ipmi: Use del_timer_shutdown() before freeing timer

Message ID 20221027150926.969147187@goodmis.org
State New
Headers
Series timers: Use del_timer_shutdown() before freeing timers |

Commit Message

Steven Rostedt Oct. 27, 2022, 3:05 p.m. UTC
  From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Before a timer is freed, del_timer_shutdown() must be called.

Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/

Cc: Corey Minyard <minyard@acm.org>
Cc: openipmi-developer@lists.sourceforge.net
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 drivers/char/ipmi/ipmi_msghandler.c | 2 +-
 drivers/char/ipmi/ipmi_ssif.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Corey Minyard Oct. 27, 2022, 3:20 p.m. UTC | #1
On Thu, Oct 27, 2022 at 11:05:35AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> Before a timer is freed, del_timer_shutdown() must be called.

Thanks, this is in my queue, or:

Acked-by: Corey Minyard <cminyard@mvista.com>

if you prefer that.

-corey

> 
> Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/
> 
> Cc: Corey Minyard <minyard@acm.org>
> Cc: openipmi-developer@lists.sourceforge.net
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  drivers/char/ipmi/ipmi_msghandler.c | 2 +-
>  drivers/char/ipmi/ipmi_ssif.c       | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 49a1707693c9..b577f66f3ca6 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -5540,7 +5540,7 @@ static void __exit cleanup_ipmi(void)
>  		 * here.
>  		 */
>  		atomic_set(&stop_operation, 1);
> -		del_timer_sync(&ipmi_timer);
> +		del_timer_shutdown(&ipmi_timer);
>  
>  		initialized = false;
>  
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index e1072809fe31..bb4df879a5ab 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1273,8 +1273,8 @@ static void shutdown_ssif(void *send_info)
>  		schedule_timeout(1);
>  
>  	ssif_info->stopping = true;
> -	del_timer_sync(&ssif_info->watch_timer);
> -	del_timer_sync(&ssif_info->retry_timer);
> +	del_timer_shutdown(&ssif_info->watch_timer);
> +	del_timer_shutdown(&ssif_info->retry_timer);
>  	if (ssif_info->thread) {
>  		complete(&ssif_info->wake_thread);
>  		kthread_stop(ssif_info->thread);
> -- 
> 2.35.1
  
Corey Minyard Oct. 27, 2022, 3:22 p.m. UTC | #2
On Thu, Oct 27, 2022 at 10:20:15AM -0500, Corey Minyard wrote:
> On Thu, Oct 27, 2022 at 11:05:35AM -0400, Steven Rostedt wrote:
> > From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> > 
> > Before a timer is freed, del_timer_shutdown() must be called.
> 
> Thanks, this is in my queue, or:
> 
> Acked-by: Corey Minyard <cminyard@mvista.com>
> 
> if you prefer that.

Well, del_timer_shutdown() isn't there yet, so I guess the Ack is what
you need.

-corey

> 
> -corey
> 
> > 
> > Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/
> > 
> > Cc: Corey Minyard <minyard@acm.org>
> > Cc: openipmi-developer@lists.sourceforge.net
> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> > ---
> >  drivers/char/ipmi/ipmi_msghandler.c | 2 +-
> >  drivers/char/ipmi/ipmi_ssif.c       | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> > index 49a1707693c9..b577f66f3ca6 100644
> > --- a/drivers/char/ipmi/ipmi_msghandler.c
> > +++ b/drivers/char/ipmi/ipmi_msghandler.c
> > @@ -5540,7 +5540,7 @@ static void __exit cleanup_ipmi(void)
> >  		 * here.
> >  		 */
> >  		atomic_set(&stop_operation, 1);
> > -		del_timer_sync(&ipmi_timer);
> > +		del_timer_shutdown(&ipmi_timer);
> >  
> >  		initialized = false;
> >  
> > diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> > index e1072809fe31..bb4df879a5ab 100644
> > --- a/drivers/char/ipmi/ipmi_ssif.c
> > +++ b/drivers/char/ipmi/ipmi_ssif.c
> > @@ -1273,8 +1273,8 @@ static void shutdown_ssif(void *send_info)
> >  		schedule_timeout(1);
> >  
> >  	ssif_info->stopping = true;
> > -	del_timer_sync(&ssif_info->watch_timer);
> > -	del_timer_sync(&ssif_info->retry_timer);
> > +	del_timer_shutdown(&ssif_info->watch_timer);
> > +	del_timer_shutdown(&ssif_info->retry_timer);
> >  	if (ssif_info->thread) {
> >  		complete(&ssif_info->wake_thread);
> >  		kthread_stop(ssif_info->thread);
> > -- 
> > 2.35.1
  
Steven Rostedt Oct. 27, 2022, 3:31 p.m. UTC | #3
On Thu, 27 Oct 2022 10:22:54 -0500
Corey Minyard <minyard@acm.org> wrote:

> Well, del_timer_shutdown() isn't there yet, so I guess the Ack is what
> you need.

Yep :-)

I need Thomas and Linus's OK on that too, hence the RFC.

-- Steve
  

Patch

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 49a1707693c9..b577f66f3ca6 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -5540,7 +5540,7 @@  static void __exit cleanup_ipmi(void)
 		 * here.
 		 */
 		atomic_set(&stop_operation, 1);
-		del_timer_sync(&ipmi_timer);
+		del_timer_shutdown(&ipmi_timer);
 
 		initialized = false;
 
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index e1072809fe31..bb4df879a5ab 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1273,8 +1273,8 @@  static void shutdown_ssif(void *send_info)
 		schedule_timeout(1);
 
 	ssif_info->stopping = true;
-	del_timer_sync(&ssif_info->watch_timer);
-	del_timer_sync(&ssif_info->retry_timer);
+	del_timer_shutdown(&ssif_info->watch_timer);
+	del_timer_shutdown(&ssif_info->retry_timer);
 	if (ssif_info->thread) {
 		complete(&ssif_info->wake_thread);
 		kthread_stop(ssif_info->thread);