Commit 6677fe47 authored by Justin Green's avatar Justin Green Committed by Liu Chuang
Browse files

drm/mediatek: Add 0 size check to mtk_drm_gem_obj

stable inclusion
from stable-v4.19.316
commit 79078880795478d551a05acc41f957700030d364
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IA6S8E
CVE: CVE-2024-38549

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=79078880795478d551a05acc41f957700030d364



--------------------------------

[ Upstream commit 1e4350095e8ab2577ee05f8c3b044e661b5af9a0 ]

Add a check to mtk_drm_gem_init if we attempt to allocate a GEM object
of 0 bytes. Currently, no such check exists and the kernel will panic if
a userspace application attempts to allocate a 0x0 GBM buffer.

Tested by attempting to allocate a 0x0 GBM buffer on an MT8188 and
verifying that we now return EINVAL.

Fixes: 119f5173 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.")
Signed-off-by: default avatarJustin Green <greenjustin@chromium.org>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarCK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240307180051.4104425-1-greenjustin@chromium.org/


Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiu Chuang <liuchuang40@huawei.com>
parent 3b43b21c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment