From: Wen Yang <wen.yang99@zte.com.cn>
To: linux-kernel@vger.kernel.org
Cc: wang.yi59@zte.com.cn, Neil Armstrong <narmstrong@baylibre.com>,
David Airlie <airlied@linux.ie>,
Kevin Hilman <khilman@baylibre.com>,
dri-devel@lists.freedesktop.org,
Markus Elfring <Markus.Elfring@web.de>,
Daniel Vetter <daniel@ffwll.ch>,
linux-amlogic@lists.infradead.org,
Wen Yang <wen.yang99@zte.com.cn>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] drm/meson: fix possible object reference leak
Date: Mon, 8 Apr 2019 10:58:31 +0800 [thread overview]
Message-ID: <1554692313-28882-1-git-send-email-wen.yang99@zte.com.cn> (raw)
The call to of_graph_get_remote_port returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
drivers/gpu/drm/meson/meson_dw_hdmi.c:725:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 722, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Markus Elfring <Markus.Elfring@web.de>
---
v2->v1: convert a if statement into a ternary statement.
drivers/gpu/drm/meson/meson_dw_hdmi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 563953e..826b98b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -720,15 +720,10 @@ static bool meson_hdmi_connector_is_available(struct device *dev)
/* If the endpoint node exists, consider it enabled */
remote = of_graph_get_remote_port(ep);
- if (remote) {
- of_node_put(ep);
- return true;
- }
-
of_node_put(ep);
of_node_put(remote);
- return false;
+ return remote ? true : false;
}
static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
--
2.9.5
next reply other threads:[~2019-04-08 2:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 2:58 Wen Yang [this message]
2019-04-08 2:58 ` [PATCH v2] drm/omap: fix possible object reference leak Wen Yang
2019-04-08 8:49 ` Mukesh Ojha
2019-04-08 2:58 ` [PATCH v2] drm: rcar-du: " Wen Yang
2019-04-08 8:45 ` Mukesh Ojha
2019-04-08 9:23 ` wen.yang99
2019-04-08 16:38 ` Markus Elfring
2019-04-08 9:13 ` [PATCH v2] drm/meson: " Markus Elfring
2019-04-08 10:25 ` wen.yang99
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=1554692313-28882-1-git-send-email-wen.yang99@zte.com.cn \
--to=wen.yang99@zte.com.cn \
--cc=Markus.Elfring@web.de \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=wang.yi59@zte.com.cn \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).