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

Message ID 20221027150927.162027754@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: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jason A. Donenfeld Oct. 27, 2022, 3:55 p.m. UTC | #1
On Thu, Oct 27, 2022 at 11:05:36AM -0400, Steven Rostedt wrote:
> 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: "Theodore Ts'o" <tytso@mit.edu>
> Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

If this patchset lands,

    Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>

However, please keep with the uniform subject convention for commits to
that file. Namely, title this:

    random: use del_timer_shutdown() before freeing timer

Jason
  

Patch

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 2fe28eeb2f38..b774fdefc840 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1233,7 +1233,7 @@  static void __cold try_to_generate_entropy(void)
 		stack.entropy = random_get_entropy();
 	}
 
-	del_timer_sync(&stack.timer);
+	del_timer_shutdown(&stack.timer);
 	destroy_timer_on_stack(&stack.timer);
 	mix_pool_bytes(&stack.entropy, sizeof(stack.entropy));
 }