From: Johan Hovold <johan@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Johan Hovold <johan@kernel.org>,
airlied@linux.ie, jcrouse@codeaurora.org, robdclark@gmail.com,
robh@kernel.org, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] drm/msm: fix OF child-node lookup" failed to apply to 4.14-stable tree
Date: Wed, 5 Dec 2018 08:38:14 +0100 [thread overview]
Message-ID: <20181205073814.GA20713@localhost> (raw)
In-Reply-To: <20181129080629.GC13859@kroah.com>
On Thu, Nov 29, 2018 at 09:06:29AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Nov 27, 2018 at 07:19:38AM -0800, Johan Hovold wrote:
> > On Mon, Nov 19, 2018 at 03:07:37PM +0100, Greg Kroah-Hartman wrote:
> > >
> > > The patch below does not apply to the 4.14-stable tree.
> > > If someone wants it applied there, or to any other stable or longterm
> > > tree, then please email the backport, including the original git commit
> > > id to <stable@vger.kernel.org>.
> >
> > This one also depends on
> >
> > 36156f9241cb ("of: add helper to lookup compatible child node")
>
> No, still does not apply to 4.14 even with that patch :(
Looks like the function in question was moved by commit 999ae6edc1c1
("drm/msm/adreno: Move clock parsing to adreno_gpu_init()").
Compile-tested backport below.
Johan
>From 8ac9a34ac02928bcc2975fd3da39671fd4d533e7 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan@kernel.org>
Date: Mon, 27 Aug 2018 10:21:47 +0200
Subject: [PATCH] drm/msm: fix OF child-node lookup
commit f9a7082327e26f54067a49cac2316d31e0cc8ba7 upstream.
Use the new of_get_compatible_child() helper to lookup the legacy
pwrlevels child node instead of using of_find_compatible_node(), which
searches the entire tree from a given start node and thus can return an
unrelated (i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe
deferral) as the tree-wide helper drops a reference to its first
argument (i.e. the probed device's node).
While at it, also fix the related child-node reference leak.
Fixes: e2af8b6b0ca1 ("drm/msm: gpu: Use OPP tables if we can")
Cc: stable <stable@vger.kernel.org> # 4.12
Cc: Jordan Crouse <jcrouse@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
[ johan: backport to 4.14 ]
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index c75c4df4bc39..2c379774d3f2 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -223,8 +223,7 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)
struct device_node *child, *node;
int ret;
- node = of_find_compatible_node(dev->of_node, NULL,
- "qcom,gpu-pwrlevels");
+ node = of_get_compatible_child(dev->of_node, "qcom,gpu-pwrlevels");
if (!node) {
dev_err(dev, "Could not find the GPU powerlevels\n");
return -ENXIO;
@@ -245,6 +244,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)
dev_pm_opp_add(dev, val, 0);
}
+ of_node_put(node);
+
return 0;
}
--
2.19.2
next prev parent reply other threads:[~2018-12-05 7:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 14:07 FAILED: patch "[PATCH] drm/msm: fix OF child-node lookup" failed to apply to 4.14-stable tree gregkh
2018-11-27 15:19 ` Johan Hovold
2018-11-29 8:06 ` Greg KH
2018-12-05 7:38 ` Johan Hovold [this message]
2018-12-06 10:40 ` Greg KH
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=20181205073814.GA20713@localhost \
--to=johan@kernel.org \
--cc=airlied@linux.ie \
--cc=gregkh@linuxfoundation.org \
--cc=jcrouse@codeaurora.org \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
/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