Skip to content

Commit

Permalink
drm/msm: uninitialized variable in msm_gem_import()
Browse files Browse the repository at this point in the history
The msm_gem_new_impl() function cleans up after itself so there is no
need to call drm_gem_object_put().  Conceptually, it does not make sense
to call a kref_put() function until after the reference counting has
been initialized which happens immediately after this call in the
drm_gem_(private_)object_init() functions.

In the msm_gem_import() function the "obj" pointer is uninitialized, so
it will lead to a crash.

Fixes: 05b8491 ("drm/msm: prime support")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://lore.kernel.org/r/20211013081315.GG6010@kili
Signed-off-by: Rob Clark <[email protected]>
  • Loading branch information
Dan Carpenter authored and robclark committed Oct 15, 2021
1 parent 027d052 commit 2203bd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/msm/msm_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, uint32_t size, uint32

ret = msm_gem_new_impl(dev, size, flags, &obj);
if (ret)
goto fail;
return ERR_PTR(ret);

msm_obj = to_msm_bo(obj);

Expand Down Expand Up @@ -1251,7 +1251,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,

ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj);
if (ret)
goto fail;
return ERR_PTR(ret);

drm_gem_private_object_init(dev, obj, size);

Expand Down

0 comments on commit 2203bd0

Please sign in to comment.