[PATCH] ehea: Fix memory hook reference counting crashes

David Miller davem at davemloft.net
Sun Apr 26 04:43:54 AEST 2015


From: Michael Ellerman <mpe at ellerman.id.au>
Date: Fri, 24 Apr 2015 15:52:32 +1000

> The recent commit to only register the EHEA memory hotplug hooks on
> adapter probe has a few problems.
> 
> Firstly the reference counting is wrong for multiple adapters, in that
> the hooks are registered multiple times. Secondly the check in the tear
> down path is backward. Finally the error path doesn't decrement the
> count.
> 
> The multiple registration of the hooks is the biggest problem, as it
> leads to oopses when the system is rebooted, and/or errors during memory
> hotplug, eg:
 ...
> Fixes: aa183323312d ("ehea: Register memory hotplug, reboot and crash hooks on adapter probe")
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>

Applied, but using an atomic counter for this is really inappropriate
and is what lead to this bug in the first place.

You're not counting anything, because if you were, then you would be
decrementing this thing somewhere.

Rather, it's purely a boolean state saying "I did X".  So it should be
a boolean, and no atomicity nor other special considerations are
needed for setting it to true.


More information about the Linuxppc-dev mailing list