• Johan Hovold's avatar
    drm/msm: fix OF child-node lookup · 84ee7f89
    Johan Hovold authored
    commit f9a70823 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: e2af8b6b ("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: default avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: default avatarRob Herring <robh@kernel.org>
    [ johan: backport to 4.14 ]
    Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    84ee7f89
adreno_device.c 8.88 KB