linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc/tegra: pmc: fix child-node lookup
@ 2017-11-15  9:44 Johan Hovold
  2017-11-16 11:40 ` Mikko Perttunen
  2018-03-22 14:24 ` Thierry Reding
  0 siblings, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2017-11-15  9:44 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, linux-tegra, linux-kernel, Johan Hovold, stable,
	Mikko Perttunen

Fix child-node lookup during probe, which ended up searching the whole
device tree depth-first starting at the parent rather than just matching
on its children.

To make things worse, the parent pmc node could end up being prematurely
freed as of_find_node_by_name() drops a reference to its first argument.

Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
Cc: stable <stable@vger.kernel.org>     # 4.0
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/soc/tegra/pmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 0453ff6839a7..7e9ef3431bea 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1321,7 +1321,7 @@ static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
 	if (!pmc->soc->has_tsense_reset)
 		return;
 
-	np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
+	np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
 	if (!np) {
 		dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
 		return;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2017-11-15  9:44 [PATCH] soc/tegra: pmc: fix child-node lookup Johan Hovold
@ 2017-11-16 11:40 ` Mikko Perttunen
  2018-01-12  9:19   ` Johan Hovold
  2018-03-22 14:24 ` Thierry Reding
  1 sibling, 1 reply; 7+ messages in thread
From: Mikko Perttunen @ 2017-11-16 11:40 UTC (permalink / raw)
  To: Johan Hovold, Thierry Reding
  Cc: Jonathan Hunter, linux-tegra, linux-kernel, stable, Mikko Perttunen

On 15.11.2017 11:44, Johan Hovold wrote:
> Fix child-node lookup during probe, which ended up searching the whole
> device tree depth-first starting at the parent rather than just matching
> on its children.
>
> To make things worse, the parent pmc node could end up being prematurely
> freed as of_find_node_by_name() drops a reference to its first argument.
>
> Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> Cc: stable <stable@vger.kernel.org>     # 4.0
> Cc: Mikko Perttunen <mperttunen@nvidia.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/soc/tegra/pmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> index 0453ff6839a7..7e9ef3431bea 100644
> --- a/drivers/soc/tegra/pmc.c
> +++ b/drivers/soc/tegra/pmc.c
> @@ -1321,7 +1321,7 @@ static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
>  	if (!pmc->soc->has_tsense_reset)
>  		return;
>
> -	np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
> +	np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
>  	if (!np) {
>  		dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
>  		return;
>

Good find!

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2017-11-16 11:40 ` Mikko Perttunen
@ 2018-01-12  9:19   ` Johan Hovold
  2018-03-22 13:52     ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2018-01-12  9:19 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding
  Cc: Johan Hovold, Jonathan Hunter, linux-tegra, linux-kernel, stable,
	Mikko Perttunen

On Thu, Nov 16, 2017 at 01:40:24PM +0200, Mikko Perttunen wrote:
> On 15.11.2017 11:44, Johan Hovold wrote:
> > Fix child-node lookup during probe, which ended up searching the whole
> > device tree depth-first starting at the parent rather than just matching
> > on its children.
> >
> > To make things worse, the parent pmc node could end up being prematurely
> > freed as of_find_node_by_name() drops a reference to its first argument.
> >
> > Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> > Cc: stable <stable@vger.kernel.org>     # 4.0
> > Cc: Mikko Perttunen <mperttunen@nvidia.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/soc/tegra/pmc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> > index 0453ff6839a7..7e9ef3431bea 100644
> > --- a/drivers/soc/tegra/pmc.c
> > +++ b/drivers/soc/tegra/pmc.c
> > @@ -1321,7 +1321,7 @@ static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
> >  	if (!pmc->soc->has_tsense_reset)
> >  		return;
> >
> > -	np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
> > +	np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
> >  	if (!np) {
> >  		dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
> >  		return;
> >
> 
> Good find!
> 
> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

This one still hasn't made it to linux-next so figured I'd send a
reminder. Will you be picking this one up for 4.16, Thierry?

Thanks,
Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2018-01-12  9:19   ` Johan Hovold
@ 2018-03-22 13:52     ` Johan Hovold
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2018-03-22 13:52 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding
  Cc: Johan Hovold, Jonathan Hunter, linux-tegra, linux-kernel, stable,
	Mikko Perttunen

On Fri, Jan 12, 2018 at 10:19:51AM +0100, Johan Hovold wrote:
> On Thu, Nov 16, 2017 at 01:40:24PM +0200, Mikko Perttunen wrote:
> > On 15.11.2017 11:44, Johan Hovold wrote:
> > > Fix child-node lookup during probe, which ended up searching the whole
> > > device tree depth-first starting at the parent rather than just matching
> > > on its children.
> > >
> > > To make things worse, the parent pmc node could end up being prematurely
> > > freed as of_find_node_by_name() drops a reference to its first argument.
> > >
> > > Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> > > Cc: stable <stable@vger.kernel.org>     # 4.0
> > > Cc: Mikko Perttunen <mperttunen@nvidia.com>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > ---
> > >  drivers/soc/tegra/pmc.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> > > index 0453ff6839a7..7e9ef3431bea 100644
> > > --- a/drivers/soc/tegra/pmc.c
> > > +++ b/drivers/soc/tegra/pmc.c
> > > @@ -1321,7 +1321,7 @@ static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
> > >  	if (!pmc->soc->has_tsense_reset)
> > >  		return;
> > >
> > > -	np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
> > > +	np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
> > >  	if (!np) {
> > >  		dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
> > >  		return;
> > >
> > 
> > Good find!
> > 
> > Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
> 
> This one still hasn't made it to linux-next so figured I'd send a
> reminder. Will you be picking this one up for 4.16, Thierry?

Another two months, another reminder; Thierry, can you pick this fix up?
It's got Mikko's ack.

Mikko, can you please ping Thierry in case I'm getting stuck in his spam
filter or something?

Thanks,
Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2017-11-15  9:44 [PATCH] soc/tegra: pmc: fix child-node lookup Johan Hovold
  2017-11-16 11:40 ` Mikko Perttunen
@ 2018-03-22 14:24 ` Thierry Reding
  2018-08-13 14:33   ` Johan Hovold
  1 sibling, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2018-03-22 14:24 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Jonathan Hunter, linux-tegra, linux-kernel, stable, Mikko Perttunen

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

On Wed, Nov 15, 2017 at 10:44:58AM +0100, Johan Hovold wrote:
> Fix child-node lookup during probe, which ended up searching the whole
> device tree depth-first starting at the parent rather than just matching
> on its children.
> 
> To make things worse, the parent pmc node could end up being prematurely
> freed as of_find_node_by_name() drops a reference to its first argument.
> 
> Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> Cc: stable <stable@vger.kernel.org>     # 4.0
> Cc: Mikko Perttunen <mperttunen@nvidia.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/soc/tegra/pmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2018-03-22 14:24 ` Thierry Reding
@ 2018-08-13 14:33   ` Johan Hovold
  2018-08-14 14:24     ` Thierry Reding
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2018-08-13 14:33 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Johan Hovold, Jonathan Hunter, linux-tegra, linux-kernel, stable,
	Mikko Perttunen

Hi Thierry,

On Thu, Mar 22, 2018 at 03:24:32PM +0100, Thierry Reding wrote:
> On Wed, Nov 15, 2017 at 10:44:58AM +0100, Johan Hovold wrote:
> > Fix child-node lookup during probe, which ended up searching the whole
> > device tree depth-first starting at the parent rather than just matching
> > on its children.
> > 
> > To make things worse, the parent pmc node could end up being prematurely
> > freed as of_find_node_by_name() drops a reference to its first argument.
> > 
> > Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> > Cc: stable <stable@vger.kernel.org>     # 4.0
> > Cc: Mikko Perttunen <mperttunen@nvidia.com>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/soc/tegra/pmc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Applied, thanks.

I noticed this one still hasn't made it into linux-next. Looks like it
wasn't included in you 4.17 pull request and is still sitting in the
tegra for-4.17/soc branch.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] soc/tegra: pmc: fix child-node lookup
  2018-08-13 14:33   ` Johan Hovold
@ 2018-08-14 14:24     ` Thierry Reding
  0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2018-08-14 14:24 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Jonathan Hunter, linux-tegra, linux-kernel, Mikko Perttunen

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

On Mon, Aug 13, 2018 at 04:33:17PM +0200, Johan Hovold wrote:
> Hi Thierry,
> 
> On Thu, Mar 22, 2018 at 03:24:32PM +0100, Thierry Reding wrote:
> > On Wed, Nov 15, 2017 at 10:44:58AM +0100, Johan Hovold wrote:
> > > Fix child-node lookup during probe, which ended up searching the whole
> > > device tree depth-first starting at the parent rather than just matching
> > > on its children.
> > > 
> > > To make things worse, the parent pmc node could end up being prematurely
> > > freed as of_find_node_by_name() drops a reference to its first argument.
> > > 
> > > Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
> > > Cc: stable <stable@vger.kernel.org>     # 4.0
> > > Cc: Mikko Perttunen <mperttunen@nvidia.com>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > ---
> > >  drivers/soc/tegra/pmc.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Applied, thanks.
> 
> I noticed this one still hasn't made it into linux-next. Looks like it
> wasn't included in you 4.17 pull request and is still sitting in the
> tegra for-4.17/soc branch.

Indeed. Looking at my tree it seems like I applied this to for-4.17/soc
a couple of days after the signed tag for the pull request. It probably
should've gone into a for-4.18/soc, or perhaps into fixes pull request.

I've cherry-picked it into for-4.20/soc now. Thanks for the reminder.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-14 14:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-15  9:44 [PATCH] soc/tegra: pmc: fix child-node lookup Johan Hovold
2017-11-16 11:40 ` Mikko Perttunen
2018-01-12  9:19   ` Johan Hovold
2018-03-22 13:52     ` Johan Hovold
2018-03-22 14:24 ` Thierry Reding
2018-08-13 14:33   ` Johan Hovold
2018-08-14 14:24     ` Thierry Reding

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).