mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] hte: fix possible use-after-free in tegra_hte_test_remove()
@ 2022-05-06  8:48 Yang Yingliang
  2022-05-06 18:09 ` Dipen Patel
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-05-06  8:48 UTC (permalink / raw)
  To: linux-kernel, linux-tegra; +Cc: jonathanh, thierry.reding, dipenp

del_timer() does not wait until the timer handler finishing.
This means that the timer handler may still be running after
the driver's remove function has finished, which would result
in a use-after-free.
Fix it by calling del_timer_sync(), which makes sure the timer
handler has finished.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/hte/hte-tegra194-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c
index bc3ab18dfdc5..f69a274a7d8d 100644
--- a/drivers/hte/hte-tegra194-test.c
+++ b/drivers/hte/hte-tegra194-test.c
@@ -220,7 +220,7 @@ static int tegra_hte_test_remove(struct platform_device *pdev)
 	free_irq(hte.gpio_in_irq, &hte);
 	gpiod_put(hte.gpio_in);
 	gpiod_put(hte.gpio_out);
-	del_timer(&hte.timer);
+	del_timer_sync(&hte.timer);
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-06 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  8:48 [PATCH -next] hte: fix possible use-after-free in tegra_hte_test_remove() Yang Yingliang
2022-05-06 18:09 ` Dipen Patel

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®