git: 5ea6546660de - stable/14 - LinuxKPI: Improve timer_shutdown_sync
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 01 Aug 2024 22:27:24 UTC
The branch stable/14 has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=5ea6546660def3b853208c3eee236a21d9a317f8
commit 5ea6546660def3b853208c3eee236a21d9a317f8
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-04-08 06:47:42 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-08-01 21:09:38 +0000
LinuxKPI: Improve timer_shutdown_sync
timer_shutdown_sync not only shutdowns a timer but prevents it rearming.
Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week
(cherry picked from commit 61fb195e8dd08d4b006a176c09682f061424cb95)
---
sys/compat/linuxkpi/common/src/linux_compat.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 894e233042e3..90d03d480089 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1920,6 +1920,10 @@ linux_timer_callback_wrapper(void *context)
timer = context;
+ /* the timer is about to be shutdown permanently */
+ if (timer->function == NULL)
+ return;
+
if (linux_set_current_flags(curthread, M_NOWAIT)) {
/* try again later */
callout_reset(&timer->callout, 1,
@@ -1992,6 +1996,7 @@ int
timer_shutdown_sync(struct timer_list *timer)
{
+ timer->function = NULL;
return (del_timer_sync(timer));
}