]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open
authorAditya Pakki <pakki001@umn.edu>
Sun, 14 Jun 2020 01:33:42 +0000 (20:33 -0500)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:15:01 +0000 (05:15 -0400)
BugLink: https://bugs.launchpad.net/bugs/1895174
[ Upstream commit bfad51c7633325b5d4b32444efe04329d53297b2 ]

nouveau_fbcon_open() calls calls pm_runtime_get_sync() that
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/gpu/drm/nouveau/nouveau_fbcon.c

index 5cf2381f667e28ffe2383bc1e618b783453e9afe..c09ea357e88f007900d0b6df5d42e49026e783a0 100644 (file)
@@ -189,8 +189,10 @@ nouveau_fbcon_open(struct fb_info *info, int user)
        struct nouveau_fbdev *fbcon = info->par;
        struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
        int ret = pm_runtime_get_sync(drm->dev->dev);
-       if (ret < 0 && ret != -EACCES)
+       if (ret < 0 && ret != -EACCES) {
+               pm_runtime_put(drm->dev->dev);
                return ret;
+       }
        return 0;
 }