]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/msm: Fix NULL pointer dereference in crashstate_get_vm_logs()
authorHuiwen He <hehuiwen@kylinos.cn>
Wed, 12 Nov 2025 17:04:11 +0000 (01:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:03 +0000 (14:03 +0100)
commit0bc9149da210df7e9a191dde246b89d9ad23be8a
treede7a1ca8631938c85b08be30247722a2c183d146
parentd36f07b8e59054fe6d35b7c6eaa623d6004c8449
drm/msm: Fix NULL pointer dereference in crashstate_get_vm_logs()

[ Upstream commit 3099e0247e3217e1b39c1c61766e06ec3d13835f ]

crashstate_get_vm_logs() did not check the return value of
kmalloc_array(). In low-memory situations, kmalloc_array() may return
NULL, leading to a NULL pointer dereference when the function later
accesses state->vm_logs.

Fix this by checking the return value of kmalloc_array() and setting
state->nr_vm_logs to 0 if allocation fails.

Fixes: 9edc52967cc7 ("drm/msm: Add VM logging for VM_BIND updates")
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Patchwork: https://patchwork.freedesktop.org/patch/687555/
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/msm_gpu.c