mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] virt: vbox: fix possible circular timer scheduling
@ 2025-11-22 18:21 Alexey Simakov
  0 siblings, 0 replies; only message in thread
From: Alexey Simakov @ 2025-11-22 18:21 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Alexey Simakov, Arnd Bergmann, Greg Kroah-Hartman, Larry Finger,
	linux-kernel, lvc-project

According to timer.c documentation, callers of this function should ensure
the timer is not rearmed.  Meanwhile, the heartbeat callback may itself
reschedule the heartbeat timer which could lead to theoretically
indefinite loop iterations inside __timer_delete_sync(), due to a race
when the heartbeat callback is always running when it's attempted to be
detached.

Use timer_shutdown_sync() instead to avoid this issue.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0ba002bc4393 ("virt: Add vboxguest driver for Virtual Box Guest integration"):
Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
---
 drivers/virt/vboxguest/vboxguest_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virt/vboxguest/vboxguest_core.c b/drivers/virt/vboxguest/vboxguest_core.c
index b177a534b6a4..508ba711669d 100644
--- a/drivers/virt/vboxguest/vboxguest_core.c
+++ b/drivers/virt/vboxguest/vboxguest_core.c
@@ -495,7 +495,7 @@ static int vbg_heartbeat_init(struct vbg_dev *gdev)
  */
 static void vbg_heartbeat_exit(struct vbg_dev *gdev)
 {
-	timer_delete_sync(&gdev->heartbeat_timer);
+	timer_shutdown_sync(&gdev->heartbeat_timer);
 	vbg_heartbeat_host_config(gdev, false);
 	vbg_req_free(gdev->guest_heartbeat_req,
 		     sizeof(*gdev->guest_heartbeat_req));
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-22 18:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-22 18:21 [PATCH] virt: vbox: fix possible circular timer scheduling Alexey Simakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®