public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: gregkh@linuxfoundation.org
Cc: johan@kernel.org, felipe.balbi@linux.intel.com, neilb@suse.de,
	robh@kernel.org, sre@kernel.org, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] power: supply: twl4030-charger: fix OF sibling-node lookup" failed to apply to 4.14-stable tree
Date: Tue, 27 Nov 2018 07:17:22 -0800	[thread overview]
Message-ID: <20181127151722.GR2403@localhost> (raw)
In-Reply-To: <15419531757991@kroah.com>

On Sun, Nov 11, 2018 at 08:19:35AM -0800, 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")

Johan

> ------------------ original commit in Linus's tree ------------------
> 
> From 9844fb2e351311210e6660a9a1c62d17424a6145 Mon Sep 17 00:00:00 2001
> From: Johan Hovold <johan@kernel.org>
> Date: Mon, 27 Aug 2018 10:21:53 +0200
> Subject: [PATCH] power: supply: twl4030-charger: fix OF sibling-node lookup
> 
> Use the new of_get_compatible_child() helper to lookup the usb sibling
> node instead of using of_find_compatible_node(), which searches the
> entire tree from a given start node and thus can return an unrelated
> (non-sibling) 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 parent device node).
> 
> While at it, also fix the related phy-node reference leak.
> 
> Fixes: f5e4edb8c888 ("power: twl4030_charger: find associated phy by more reliable means.")
> Cc: stable <stable@vger.kernel.org>     # 4.2
> Cc: NeilBrown <neilb@suse.de>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Sebastian Reichel <sre@kernel.org>
> Reviewed-by: Sebastian Reichel <sre@kernel.org>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> 
> diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
> index bbcaee56db9d..b6a7d9f74cf3 100644
> --- a/drivers/power/supply/twl4030_charger.c
> +++ b/drivers/power/supply/twl4030_charger.c
> @@ -996,12 +996,13 @@ static int twl4030_bci_probe(struct platform_device *pdev)
>  	if (bci->dev->of_node) {
>  		struct device_node *phynode;
>  
> -		phynode = of_find_compatible_node(bci->dev->of_node->parent,
> -						  NULL, "ti,twl4030-usb");
> +		phynode = of_get_compatible_child(bci->dev->of_node->parent,
> +						  "ti,twl4030-usb");
>  		if (phynode) {
>  			bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
>  			bci->transceiver = devm_usb_get_phy_by_node(
>  				bci->dev, phynode, &bci->usb_nb);
> +			of_node_put(phynode);
>  			if (IS_ERR(bci->transceiver)) {
>  				ret = PTR_ERR(bci->transceiver);
>  				if (ret == -EPROBE_DEFER)
> 

  reply	other threads:[~2018-11-28  2:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 16:19 FAILED: patch "[PATCH] power: supply: twl4030-charger: fix OF sibling-node lookup" failed to apply to 4.14-stable tree gregkh
2018-11-27 15:17 ` Johan Hovold [this message]
2018-11-28 15:31   ` Sasha Levin

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=20181127151722.GR2403@localhost \
    --to=johan@kernel.org \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=neilb@suse.de \
    --cc=robh@kernel.org \
    --cc=sre@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