linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
@ 2017-07-21 14:51 Laurent Vivier
  2017-07-24  0:56 ` David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Laurent Vivier @ 2017-07-21 14:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Gibson, Michael Ellerman, linuxppc-dev, Tyrel Datwyler,
	Thomas Huth

As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
underflow during DLPAR remove"), the call to of_node_put()
must be removed from pSeries_reconfig_remove_node().

dlpar_detach_node() and pSeries_reconfig_remove_node() call
of_detach_node(), and thus the node should not be released
in this case too.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 arch/powerpc/platforms/pseries/reconfig.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index e5bf1e8..011ef21 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -82,7 +82,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
 
 	of_detach_node(np);
 	of_node_put(parent);
-	of_node_put(np); /* Must decrement the refcount */
 	return 0;
 }
 
-- 
2.9.4

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

* Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-21 14:51 [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Laurent Vivier
@ 2017-07-24  0:56 ` David Gibson
  2017-07-24 10:42 ` Michael Ellerman
  2017-07-27 12:38 ` Michael Ellerman
  2 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2017-07-24  0:56 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: linux-kernel, Michael Ellerman, linuxppc-dev, Tyrel Datwyler,
	Thomas Huth

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

On Fri, Jul 21, 2017 at 04:51:39PM +0200, Laurent Vivier wrote:
> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
> underflow during DLPAR remove"), the call to of_node_put()
> must be removed from pSeries_reconfig_remove_node().
> 
> dlpar_detach_node() and pSeries_reconfig_remove_node() call
> of_detach_node(), and thus the node should not be released
> in this case too.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  arch/powerpc/platforms/pseries/reconfig.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index e5bf1e8..011ef21 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -82,7 +82,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
>  
>  	of_detach_node(np);
>  	of_node_put(parent);
> -	of_node_put(np); /* Must decrement the refcount */
>  	return 0;
>  }
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

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

* Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-21 14:51 [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Laurent Vivier
  2017-07-24  0:56 ` David Gibson
@ 2017-07-24 10:42 ` Michael Ellerman
  2017-07-24 18:42   ` Tyrel Datwyler
  2017-07-27 12:38 ` Michael Ellerman
  2 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2017-07-24 10:42 UTC (permalink / raw)
  To: Laurent Vivier, linux-kernel
  Cc: David Gibson, linuxppc-dev, Tyrel Datwyler, Thomas Huth

Laurent Vivier <lvivier@redhat.com> writes:

> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
> underflow during DLPAR remove"), the call to of_node_put()
> must be removed from pSeries_reconfig_remove_node().
>
> dlpar_detach_node() and pSeries_reconfig_remove_node() call
> of_detach_node(), and thus the node should not be released
> in this case too.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  arch/powerpc/platforms/pseries/reconfig.c | 1 -
>  1 file changed, 1 deletion(-)

Thanks. I'll spare you the swearing about why we have the same bug in
two places.

As for the other fix, I'll add:

Fixes: 0829f6d1f69e ("of: device_node kobject lifecycle fixes")
Cc: stable@vger.kernel.org # v3.15+

cheers

> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index e5bf1e8..011ef21 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -82,7 +82,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
>  
>  	of_detach_node(np);
>  	of_node_put(parent);
> -	of_node_put(np); /* Must decrement the refcount */
>  	return 0;
>  }
>  
> -- 
> 2.9.4

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

* Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-24 10:42 ` Michael Ellerman
@ 2017-07-24 18:42   ` Tyrel Datwyler
  2017-07-25  4:47     ` Michael Ellerman
  0 siblings, 1 reply; 7+ messages in thread
From: Tyrel Datwyler @ 2017-07-24 18:42 UTC (permalink / raw)
  To: Michael Ellerman, Laurent Vivier, linux-kernel
  Cc: David Gibson, linuxppc-dev, Tyrel Datwyler, Thomas Huth

On 07/24/2017 03:42 AM, Michael Ellerman wrote:
> Laurent Vivier <lvivier@redhat.com> writes:
> 
>> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
>> underflow during DLPAR remove"), the call to of_node_put()
>> must be removed from pSeries_reconfig_remove_node().
>>
>> dlpar_detach_node() and pSeries_reconfig_remove_node() call
>> of_detach_node(), and thus the node should not be released
>> in this case too.
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>>  arch/powerpc/platforms/pseries/reconfig.c | 1 -
>>  1 file changed, 1 deletion(-)
> 
> Thanks. I'll spare you the swearing about why we have the same bug in
> two places.

That's probably my bad. I must have failed to test with older powerpc-util tooling where
drmgr uses the /proc/ofdt interface for device tree modification.

-Tyrel

> 
> As for the other fix, I'll add:
> 
> Fixes: 0829f6d1f69e ("of: device_node kobject lifecycle fixes")
> Cc: stable@vger.kernel.org # v3.15+
> 
> cheers
> 
>> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
>> index e5bf1e8..011ef21 100644
>> --- a/arch/powerpc/platforms/pseries/reconfig.c
>> +++ b/arch/powerpc/platforms/pseries/reconfig.c
>> @@ -82,7 +82,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
>>  
>>  	of_detach_node(np);
>>  	of_node_put(parent);
>> -	of_node_put(np); /* Must decrement the refcount */
>>  	return 0;
>>  }
>>  
>> -- 
>> 2.9.4

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

* Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-24 18:42   ` Tyrel Datwyler
@ 2017-07-25  4:47     ` Michael Ellerman
  2017-07-25 17:53       ` Tyrel Datwyler
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2017-07-25  4:47 UTC (permalink / raw)
  To: Tyrel Datwyler, Laurent Vivier, linux-kernel
  Cc: David Gibson, linuxppc-dev, Tyrel Datwyler, Thomas Huth

Tyrel Datwyler <turtle.in.the.kernel@gmail.com> writes:

> On 07/24/2017 03:42 AM, Michael Ellerman wrote:
>> Laurent Vivier <lvivier@redhat.com> writes:
>> 
>>> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
>>> underflow during DLPAR remove"), the call to of_node_put()
>>> must be removed from pSeries_reconfig_remove_node().
>>>
>>> dlpar_detach_node() and pSeries_reconfig_remove_node() call
>>> of_detach_node(), and thus the node should not be released
>>> in this case too.
>>>
>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>> ---
>>>  arch/powerpc/platforms/pseries/reconfig.c | 1 -
>>>  1 file changed, 1 deletion(-)
>> 
>> Thanks. I'll spare you the swearing about why we have the same bug in
>> two places.
>
> That's probably my bad. I must have failed to test with older powerpc-util tooling where
> drmgr uses the /proc/ofdt interface for device tree modification.

OK. Really we should have automated tests of the various cases, I've
just never had time to write any.

Mainly the thing that bugs me is that we still have the two separate
paths. Or if we must maintain both they could at least share more code,
the two functions do basically the same thing AFAICS.

cheers

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

* Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-25  4:47     ` Michael Ellerman
@ 2017-07-25 17:53       ` Tyrel Datwyler
  0 siblings, 0 replies; 7+ messages in thread
From: Tyrel Datwyler @ 2017-07-25 17:53 UTC (permalink / raw)
  To: Michael Ellerman, Laurent Vivier, linux-kernel
  Cc: David Gibson, linuxppc-dev, Tyrel Datwyler, Thomas Huth

On 07/24/2017 09:47 PM, Michael Ellerman wrote:
> Tyrel Datwyler <turtle.in.the.kernel@gmail.com> writes:
> 
>> On 07/24/2017 03:42 AM, Michael Ellerman wrote:
>>> Laurent Vivier <lvivier@redhat.com> writes:
>>>
>>>> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
>>>> underflow during DLPAR remove"), the call to of_node_put()
>>>> must be removed from pSeries_reconfig_remove_node().
>>>>
>>>> dlpar_detach_node() and pSeries_reconfig_remove_node() call
>>>> of_detach_node(), and thus the node should not be released
>>>> in this case too.
>>>>
>>>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>>>> ---
>>>>  arch/powerpc/platforms/pseries/reconfig.c | 1 -
>>>>  1 file changed, 1 deletion(-)
>>>
>>> Thanks. I'll spare you the swearing about why we have the same bug in
>>> two places.
>>
>> That's probably my bad. I must have failed to test with older powerpc-util tooling where
>> drmgr uses the /proc/ofdt interface for device tree modification.
> 
> OK. Really we should have automated tests of the various cases, I've
> just never had time to write any.

Agreed, some better CI is warranted.

> 
> Mainly the thing that bugs me is that we still have the two separate
> paths. Or if we must maintain both they could at least share more code,
> the two functions do basically the same thing AFAICS.

Yeah, I think that is where I dropped the ball. I wrongly assumed by not looking close
enough that code was shared in those two paths. Definitely some code de-duplication work
that can be done.

-Tyrel

> 
> cheers
> 

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

* Re: powerpc/pseries: Fix of_node_put() underflow during pseries remove
  2017-07-21 14:51 [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Laurent Vivier
  2017-07-24  0:56 ` David Gibson
  2017-07-24 10:42 ` Michael Ellerman
@ 2017-07-27 12:38 ` Michael Ellerman
  2 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2017-07-27 12:38 UTC (permalink / raw)
  To: Laurent Vivier, linux-kernel
  Cc: Thomas Huth, linuxppc-dev, Tyrel Datwyler, David Gibson

On Fri, 2017-07-21 at 14:51:39 UTC, Laurent Vivier wrote:
> As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put()
> underflow during DLPAR remove"), the call to of_node_put()
> must be removed from pSeries_reconfig_remove_node().
> 
> dlpar_detach_node() and pSeries_reconfig_remove_node() call
> of_detach_node(), and thus the node should not be released
> in this case too.
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/4fd1bd443e80b12f0a01a45fb9a793

cheers

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

end of thread, other threads:[~2017-07-27 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21 14:51 [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Laurent Vivier
2017-07-24  0:56 ` David Gibson
2017-07-24 10:42 ` Michael Ellerman
2017-07-24 18:42   ` Tyrel Datwyler
2017-07-25  4:47     ` Michael Ellerman
2017-07-25 17:53       ` Tyrel Datwyler
2017-07-27 12:38 ` Michael Ellerman

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