diff options
author | Rob Clark <robdclark@chromium.org> | 2023-02-15 15:50:48 -0800 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2023-02-22 11:22:03 -0800 |
commit | 8a86f213f4426f19511a16d886871805b35c3acf (patch) | |
tree | 83444fead9aefe43142323e96a07cff5cf7ccc5a /drivers | |
parent | 92dd0575729a423aa5524d89055e34295152a2dd (diff) | |
download | linux-stable-8a86f213f4426f19511a16d886871805b35c3acf.tar.gz linux-stable-8a86f213f4426f19511a16d886871805b35c3acf.tar.bz2 linux-stable-8a86f213f4426f19511a16d886871805b35c3acf.zip |
drm/msm: Fix potential invalid ptr free
The error path cleanup expects that chain and syncobj are either NULL or
valid pointers. But post_deps was not allocated with __GFP_ZERO.
Fixes: ab723b7a992a ("drm/msm: Add syncobj support.")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Patchwork: https://patchwork.freedesktop.org/patch/523051/
Link: https://lore.kernel.org/r/20230215235048.1166484-1-robdclark@gmail.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gem_submit.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index be4bf77103cd..ac8ed731f76d 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -637,8 +637,8 @@ static struct msm_submit_post_dep *msm_parse_post_deps(struct drm_device *dev, int ret = 0; uint32_t i, j; - post_deps = kmalloc_array(nr_syncobjs, sizeof(*post_deps), - GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); + post_deps = kcalloc(nr_syncobjs, sizeof(*post_deps), + GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); if (!post_deps) return ERR_PTR(-ENOMEM); @@ -653,7 +653,6 @@ static struct msm_submit_post_dep *msm_parse_post_deps(struct drm_device *dev, } post_deps[i].point = syncobj_desc.point; - post_deps[i].chain = NULL; if (syncobj_desc.flags) { ret = -EINVAL; |