git: 61fb195e8dd0 - main - LinuxKPI: Improve timer_shutdown_sync
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 08 Apr 2024 06:49:13 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=61fb195e8dd08d4b006a176c09682f061424cb95
commit 61fb195e8dd08d4b006a176c09682f061424cb95
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-04-08 06:47:42 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-04-08 06:47:42 +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
---
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 36ed7b84cc94..a6eb7bb17e16 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));
}