From: Marco Felsch <m.felsch@pengutronix.de> To: p.zabel@pengutronix.de, airlied@linux.ie, daniel@ffwll.ch, shawnguo@kernel.org, stefan@agner.ch, rmk+kernel@armlinux.org.uk Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 10/17] drm/imx: imx-ldb: fix edid memory leak Date: Thu, 27 Feb 2020 17:21:18 +0100 [thread overview] Message-ID: <20200227162125.10450-11-m.felsch@pengutronix.de> (raw) In-Reply-To: <20200227162125.10450-1-m.felsch@pengutronix.de> The edid memory is only freed if the component.unbind() is called. This is okay if the imx-ldb was bound but if the bind() fails we leek the memory. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/gpu/drm/imx/imx-ldb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 92fb85703c73..06b435f9b6c9 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -552,9 +552,9 @@ static int imx_ldb_panel_ddc(struct device *dev, edidp = of_get_property(child, "edid", &channel->edid_len); if (edidp) { - channel->edid = kmemdup(edidp, - channel->edid_len, - GFP_KERNEL); + channel->edid = devm_kmemdup(dev, edidp, + channel->edid_len, + GFP_KERNEL); } else if (!channel->panel) { /* fallback to display-timings node */ ret = of_get_drm_display_mode(child, @@ -711,7 +711,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, if (channel->panel) drm_panel_detach(channel->panel); - kfree(channel->edid); i2c_put_adapter(channel->ddc); } } -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Marco Felsch <m.felsch@pengutronix.de> To: p.zabel@pengutronix.de, airlied@linux.ie, daniel@ffwll.ch, shawnguo@kernel.org, stefan@agner.ch, rmk+kernel@armlinux.org.uk Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 10/17] drm/imx: imx-ldb: fix edid memory leak Date: Thu, 27 Feb 2020 17:21:18 +0100 [thread overview] Message-ID: <20200227162125.10450-11-m.felsch@pengutronix.de> (raw) In-Reply-To: <20200227162125.10450-1-m.felsch@pengutronix.de> The edid memory is only freed if the component.unbind() is called. This is okay if the imx-ldb was bound but if the bind() fails we leek the memory. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/gpu/drm/imx/imx-ldb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 92fb85703c73..06b435f9b6c9 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -552,9 +552,9 @@ static int imx_ldb_panel_ddc(struct device *dev, edidp = of_get_property(child, "edid", &channel->edid_len); if (edidp) { - channel->edid = kmemdup(edidp, - channel->edid_len, - GFP_KERNEL); + channel->edid = devm_kmemdup(dev, edidp, + channel->edid_len, + GFP_KERNEL); } else if (!channel->panel) { /* fallback to display-timings node */ ret = of_get_drm_display_mode(child, @@ -711,7 +711,6 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, if (channel->panel) drm_panel_detach(channel->panel); - kfree(channel->edid); i2c_put_adapter(channel->ddc); } } -- 2.20.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-02-27 16:23 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-27 16:21 [PATCH 00/17] DRM: imx spring-cleaning Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 01/17] drm/imx: drop useless best_encoder callback Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 02/17] drm/imx: parallel-display: fix edid memory leak Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 03/17] drm/imx: parallel-display: move panel/bridge detection to fail early Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 04/17] drm/imx: parallel-display: detach panel within drm_encoder destroy Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 05/17] drm/imx: parallel-display: split encoder and decoder states Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 06/17] imx/drm: parallel-display: split attach function Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 07/17] drm/imx: tve: add regulator_disable devm_action Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 08/17] drm/imx: tve: split global state container Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 09/17] drm/imx: imx-ldb: remove useless enum Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` Marco Felsch [this message] 2020-02-27 16:21 ` [PATCH 10/17] drm/imx: imx-ldb: fix edid memory leak Marco Felsch 2020-02-27 16:21 ` [PATCH 11/17] drm/imx: imx-ldb: release ldb-channel resources within encoder destroy Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 12/17] drm/imx: remove imx_drm_encoder_destroy helper Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 13/17] drm/imx: imx-ldb: split imx_ldb devres allocation context Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 14/17] drm/imx: imx-ldb: add ldb_is_dual helper Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 15/17] drm/imx: imx-ldb: split encoder and decoder states Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 16/17] drm/imx: imx-ldb: refactor imx_ldb_bind Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 16:21 ` [PATCH 17/17] drm/imx: fix drm_mode_config_cleanup race condition Marco Felsch 2020-02-27 16:21 ` Marco Felsch 2020-02-27 17:29 ` Daniel Vetter 2020-02-27 17:29 ` Daniel Vetter 2020-02-27 17:44 ` Lucas Stach 2020-02-27 17:44 ` Lucas Stach 2020-02-27 18:14 ` Daniel Vetter 2020-02-27 18:14 ` Daniel Vetter 2020-02-27 18:23 ` Marco Felsch 2020-02-27 18:23 ` Marco Felsch 2020-03-02 18:07 ` Philipp Zabel 2020-03-02 18:07 ` Philipp Zabel 2020-03-02 21:32 ` Daniel Vetter 2020-03-02 21:32 ` Daniel Vetter
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200227162125.10450-11-m.felsch@pengutronix.de \ --to=m.felsch@pengutronix.de \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=kernel@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=p.zabel@pengutronix.de \ --cc=rmk+kernel@armlinux.org.uk \ --cc=shawnguo@kernel.org \ --cc=stefan@agner.ch \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.