drm/tegra: put drm_gem_object ref on error in tegra_fb_create
BugLink: https://bugs.launchpad.net/bugs/2060097
[ Upstream commit 32e5a120a5105bce01561978ee55aee8e40ac0dc ]
Inside tegra_fb_create(), drm_gem_object_lookup() increments ref count of
the found object. But if the following size check fails then the last
found object's ref count should be put there as the unreferencing loop
can't detect this situation.
Found by Linux Verification Center (linuxtesting.org).
Fixes: de2ba664c3 ("gpu: host1x: drm: Add memory manager and fb")
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231215093356.12067-1-pchelkin@ispras.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0bd2c443c84ec007fd1cf4ad276e276de2f7b401)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
committed by
Roxana Nicolescu
parent
3f6af51877
commit
bc2d33cccb
@@ -159,6 +159,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
|
||||
|
||||
if (gem->size < size) {
|
||||
err = -EINVAL;
|
||||
drm_gem_object_put(gem);
|
||||
goto unreference;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user