]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
media: tc358743: fix possible use-after-free in tc358743_remove()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 6 Apr 2021 13:39:29 +0000 (15:39 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:59:43 +0000 (10:59 +0200)
commit4b7cd6777ed2b6c1fa50e76739cfdfbde32b8055
treeb05b1c1431a0798967130965eea92cac1523e274
parentb34e6a967abb68e6d75fd368fd3599a8857e8401
media: tc358743: fix possible use-after-free in tc358743_remove()

BugLink: https://bugs.launchpad.net/bugs/1928825
[ Upstream commit 6107a4fdf8554a7aa9488bdc835bb010062fa8a9 ]

This driver's remove path calls cancel_delayed_work(). However, that
function does not wait until the work function finishes. This means
that the callback function may still be running after the driver's
remove function has finished, which would result in a use-after-free.

Fix by calling cancel_delayed_work_sync(), which ensures that
the work is properly cancelled, no longer running, and unable
to re-schedule itself.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/i2c/tc358743.c