]> git.karo-electronics.de Git - linux-beck.git/commit
ehea: Fix memory hook reference counting crashes
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 24 Apr 2015 05:52:32 +0000 (15:52 +1000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Apr 2015 18:33:04 +0000 (14:33 -0400)
commit3051f39253680624504021fd3b29fc621a4fd6b6
treeef6fb8355c724f0ba1f9f18a5ee7f78b44e50d1a
parentdfc8f370316b31b9ca9ce96e50f1c438d9410b4f
ehea: Fix memory hook reference counting crashes

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:

  $ ./mem-on-off-test.sh -r 2
  ...
  ehea: memory is going offline
  ehea: LPAR memory changed - re-initializing driver
  ehea: re-initializing driver complete
  ehea: memory is going offline
  ehea: LPAR memory changed - re-initializing driver
  ehea: opcode=26c ret=fffffffffffffffc arg1=8000000003000003 arg2=0 arg3=700000060000d600 arg4=3fded0000 arg5=200 arg6=0 arg7=0
  ehea: register_rpage_mr failed
  ehea: registering mr failed
  ehea: register MR failed - driver inoperable!
  ehea: memory is going offline

Fixes: aa183323312d ("ehea: Register memory hotplug, reboot and crash hooks on adapter probe")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ehea/ehea_main.c