hte: Fix possible use-after-free in tegra_hte_test_remove()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 6 May 2022 08:48:51 +0000 (16:48 +0800)
committerThierry Reding <treding@nvidia.com>
Tue, 10 May 2022 13:35:25 +0000 (15:35 +0200)
commit0668e8ccd33122a350629f6583c880b62b40ab5d
tree86d265a0ad03f9d7cbaf66898e9f0f0031948a57
parente0bfb57e1b0fa93fc9ce3b6c4e40a0281cdba7bc
hte: Fix possible use-after-free in tegra_hte_test_remove()

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>
Reviewed-by: Dipen Patel <dipenp@nvidia.com>
Acked-by: Dipen Patel <dipenp@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/hte/hte-tegra194-test.c