FAILED: patch "[PATCH] drm/msm: fix OF child-node lookup" failed to apply to 4.14-stable tree
Subsystems (4)
[email protected]
maintainerThe 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 <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
f9a7082327e26f54067a49cac2316d31e0cc8ba7Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 27 Aug 2018 10:21:47 +0200
Subject: [PATCH] drm/msm: fix OF child-node lookup
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.
drivers/gpu/drm/msm/adreno/adreno_gpu.c +3 -2
@@ -633,8 +633,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 ;
@@ -655,6 +654,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)dev_pm_opp_add (dev, val,0 ); } +of_node_put (node); +return 0 ; }
Quoted 5 lines · Greg Kroah-Hartman
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 <[email protected]>.
This one also depends on
36156f9241cb ("of: add helper to lookup compatible child node")
Johan
Quoted 50 lines
------------------ original commit in Linus's tree ------------------
From
f9a7082327e26f54067a49cac2316d31e0cc8ba7Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 27 Aug 2018 10:21:47 +0200
Subject: [PATCH] drm/msm: fix OF child-node lookupUse the new
of_get_compatible_child()helper to lookup the legacy pwrlevels child node instead of usingof_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 <[email protected]> # 4.12Cc Jordan Crouse <[email protected]>Cc Rob Clark <[email protected]>Cc David Airlie <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Rob Herring <[email protected]>drivers/gpu/drm/msm/adreno/adreno_gpu.c +3
-2@@ -633,8 +633,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 ;@@ -655,6 +654,8 @@ static int adreno_get_legacy_pwrlevels(struct device *dev)dev_pm_opp_add (dev, val,0 ); } +of_node_put (node); +return 0 ; }
Greg KH
maintainerQuoted 10 lines · Johan Hovold
Quoted 5 lines · Greg Kroah-Hartman
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 <[email protected]>.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 :(
sorry,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Johan Hovold
Quoted 5 lines · Greg Kroah-Hartman
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 <[email protected]>.
Quoted 5 lines
Quoted 3 lines
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
Quoted 1 line
From
8ac9a34ac02928bcc2975fd3da39671fd4d533e7Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
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.
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +3 -2
@@ -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 ; }
Signature · 1 line
2.19.2
Greg KH
maintainerQuoted 11 lines · Johan Hovold
Quoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Johan Hovold
Quoted 5 lines · Greg Kroah-Hartman
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 <[email protected]>.This one also depends on
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
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 toadreno_gpu_init()").Compile-tested backport below.
Now queued up, thanks.
greg k-h