Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f27fbff8 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

drm/msm: uninitialized variable in msm_gem_import()



[ Upstream commit 2203bd0e5c12ffc53ffdd4fbd7b12d6ba27e0424 ]

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: 05b84911 ("drm/msm: prime support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211013081315.GG6010@kili


Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 32ac072c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1036,7 +1036,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,

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

	msm_obj = to_msm_bo(obj);

@@ -1124,7 +1124,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);