[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200528194424.11596-1-wu000273@umn.edu>
Date: Thu, 28 May 2020 14:44:23 -0500
From: wu000273@....edu
To: kjlu@....edu
Cc: wu000273@....edu,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Enrico Weigelt <info@...ux.net>,
Allison Randal <allison@...utok.net>,
Alexios Zavras <alexios.zavras@...el.com>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Rob Clark <robdclark@...il.com>,
Dave Airlie <airlied@...il.com>, linux-omap@...r.kernel.org,
linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] omapfb: Fix reference count leak in display_init_sysfs.
From: Qiushi Wu <wu000273@....edu>
kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object.
Because function omap_dss_put_device() doesn't handle dssdev->kobj,
thus we need insert kobject_put() to clean up the kobject,
when kobject_init_and_add() fails.
Fixes: f76ee892a99e ("omapfb: copy omapdss & displays for omapfb")
Signed-off-by: Qiushi Wu <wu000273@....edu>
---
drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
index 6dbe265b312d..51322ac7df07 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/display-sysfs.c
@@ -316,6 +316,7 @@ int display_init_sysfs(struct platform_device *pdev)
&pdev->dev.kobj, "%s", dssdev->alias);
if (r) {
DSSERR("failed to create sysfs files\n");
+ kobject_put(&dssdev->kobj);
omap_dss_put_device(dssdev);
goto err;
}
--
2.17.1
Powered by blists - more mailing lists