Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1693767 > unrolled thread

[PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

Started byLaurent Vivier <lvivier@redhat.com>
First post2017-07-21 17:00 +0200
Last post2017-07-27 14:40 +0200
Articles 7 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Laurent Vivier <lvivier@redhat.com> - 2017-07-21 17:00 +0200
    Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during  pseries remove David Gibson <david@gibson.dropbear.id.au> - 2017-07-24 03:10 +0200
    Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Michael Ellerman <mpe@ellerman.id.au> - 2017-07-24 12:50 +0200
      Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during  pseries remove Tyrel Datwyler <turtle.in.the.kernel@gmail.com> - 2017-07-24 20:50 +0200
        Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove Michael Ellerman <mpe@ellerman.id.au> - 2017-07-25 06:50 +0200
          Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during  pseries remove Tyrel Datwyler <turtle.in.the.kernel@gmail.com> - 2017-07-25 20:00 +0200
    Re: powerpc/pseries: Fix of_node_put() underflow during pseries remove Michael Ellerman <patch-notifications@ellerman.id.au> - 2017-07-27 14:40 +0200

#1693767 — [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

FromLaurent Vivier <lvivier@redhat.com>
Date2017-07-21 17:00 +0200
Subject[PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
Message-ID<u5Hzk-663-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1694385 — Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

FromDavid Gibson <david@gibson.dropbear.id.au>
Date2017-07-24 03:10 +0200
SubjectRe: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
Message-ID<u6A2K-6ry-9@gated-at.bofh.it>
In reply to#1693767

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [next] | [standalone]


#1694629

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-07-24 12:50 +0200
Message-ID<u6J62-3B1-19@gated-at.bofh.it>
In reply to#1693767
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

[toc] | [prev] | [next] | [standalone]


#1694999 — Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

FromTyrel Datwyler <turtle.in.the.kernel@gmail.com>
Date2017-07-24 20:50 +0200
SubjectRe: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
Message-ID<u6QAx-jq-3@gated-at.bofh.it>
In reply to#1694629
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

[toc] | [prev] | [next] | [standalone]


#1695376

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-07-25 06:50 +0200
Message-ID<u6ZXb-6Gy-11@gated-at.bofh.it>
In reply to#1694999
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

[toc] | [prev] | [next] | [standalone]


#1695983 — Re: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove

FromTyrel Datwyler <turtle.in.the.kernel@gmail.com>
Date2017-07-25 20:00 +0200
SubjectRe: [PATCH] powerpc/pseries: Fix of_node_put() underflow during pseries remove
Message-ID<u7chI-5RB-21@gated-at.bofh.it>
In reply to#1695376
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
> 

[toc] | [prev] | [next] | [standalone]


#1697943 — Re: powerpc/pseries: Fix of_node_put() underflow during pseries remove

FromMichael Ellerman <patch-notifications@ellerman.id.au>
Date2017-07-27 14:40 +0200
SubjectRe: powerpc/pseries: Fix of_node_put() underflow during pseries remove
Message-ID<u7Qf7-65e-7@gated-at.bofh.it>
In reply to#1693767
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web