drm/msm/gem: Add check for kmalloc
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 12 Dec 2022 09:11:17 +0000 (17:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:13 +0000 (09:33 +0100)
commit31c4251a20fd7addc1bf4fe801f95f9ba1b38990
tree00ae9e68055678529807d2ae8ebe086e477e7aff
parent208680ccf7bff31fc08735c2a23fd3dd3c19b903
drm/msm/gem: Add check for kmalloc

[ Upstream commit d839f0811a31322c087a859c2b181e2383daa7be ]

Add the check for the return value of kmalloc in order to avoid
NULL pointer dereference in copy_from_user.

Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/514678/
Link: https://lore.kernel.org/r/20221212091117.43511-1-jiasheng@iscas.ac.cn
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/msm_gem_submit.c