powerpc/eeh: Fix use-after-release of EEH driver
authorSam Bobroff <sbobroff@linux.ibm.com>
Fri, 25 May 2018 03:11:30 +0000 (13:11 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:24 +0000 (07:50 +0200)
commitbc0b4615cc975db67ace25e9e8cc7f7dcf207d6b
treed82de60b441ab2c8db0103e65eaae3ca76099fa8
parent04cda3ac3312f16ef8bbffa06c55dd1b04d3aad6
powerpc/eeh: Fix use-after-release of EEH driver

[ Upstream commit 46d4be41b987a6b2d25a2ebdd94cafb44e21d6c5 ]

Correct two cases where eeh_pcid_get() is used to reference the driver's
module but the reference is dropped before the driver pointer is used.

In eeh_rmv_device() also refactor a little so that only two calls to
eeh_pcid_put() are needed, rather than three and the reference isn't
taken at all if it wasn't needed.

Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/eeh_driver.c