[PATCH] drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl

대인기/Tizen Platform Lab(SR)/삼성전자 inki.dae at samsung.com
Wed May 31 07:45:20 UTC 2023


Hi,


> -----Original Message-----
> From: Min Li <lm0963hack at gmail.com>
> Sent: Friday, May 26, 2023 10:02 PM
> To: inki.dae at samsung.com
> Cc: sw0312.kim at samsung.com; kyungmin.park at samsung.com; airlied at gmail.com;
> daniel at ffwll.ch; krzysztof.kozlowski at linaro.org; alim.akhtar at samsung.com;
> dri-devel at lists.freedesktop.org; linux-arm-kernel at lists.infradead.org;
> linux-samsung-soc at vger.kernel.org; linux-kernel at vger.kernel.org
> Subject: [PATCH] drm/exynos: fix race condition UAF in
> exynos_g2d_exec_ioctl
> 
> 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.
> 

I received a report about the related issue from a white hacker before.
Thanks for contribution. :)

> Signed-off-by: Min Li <lm0963hack at gmail.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_g2d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> index ec784e58da5c..414e585ec7dd 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);
> --
> 2.34.1




More information about the dri-devel mailing list