summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMin Li <lm0963hack@gmail.com>2023-05-26 21:01:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-06-28 10:29:53 +0200
commitf012d3037c15401dd72d8717806311dc4c568ea8 (patch)
treebed7f94dca33421a036d78e43a3ab0170b689e58
parenta44b4230d2ba6a8f6245ee02667f4a39b2d568ea (diff)
downloadlinux-stable-f012d3037c15401dd72d8717806311dc4c568ea8.tar.gz
linux-stable-f012d3037c15401dd72d8717806311dc4c568ea8.tar.bz2
linux-stable-f012d3037c15401dd72d8717806311dc4c568ea8.zip
drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl
[ Upstream commit 48bfd02569f5db49cc033f259e66d57aa6efc9a3 ] If it is async, runqueue_node is freed in g2d_runqueue_worker on another worker thread. So in extreme cases, if g2d_runqueue_worker runs first, and then executes the following if statement, there will be use-after-free. Signed-off-by: Min Li <lm0963hack@gmail.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_g2d.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 471fd6c8135f..27613abeed96 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1335,7 +1335,7 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
/* Let the runqueue know that there is work to do. */
queue_work(g2d->g2d_workq, &g2d->runqueue_work);
- if (runqueue_node->async)
+ if (req->async)
goto out;
wait_for_completion(&runqueue_node->complete);