powerpc/sriov: Remove VF eeh_dev state when disabling SR-IOV
authorOliver O'Halloran <oohall@gmail.com>
Wed, 21 Aug 2019 06:26:53 +0000 (16:26 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:34:50 +0000 (08:34 +0100)
commitdaa58bde67a2e8d6e03ed0fb27adf6fe00847063
treeb10ff4e355dcfb4a2f40333393c63fe1c08d751e
parentab45b8e036b1ebd6315f54097ba62c0f72e99f25
powerpc/sriov: Remove VF eeh_dev state when disabling SR-IOV

[ Upstream commit 1fb4124ca9d456656a324f1ee29b7bf942f59ac8 ]

When disabling virtual functions on an SR-IOV adapter we currently do not
correctly remove the EEH state for the now-dead virtual functions. When
removing the pci_dn that was created for the VF when SR-IOV was enabled
we free the corresponding eeh_dev without removing it from the child device
list of the eeh_pe that contained it. This can result in crashes due to the
use-after-free.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Sam Bobroff <sbobroff@linux.ibm.com>
Tested-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190821062655.19735-1-oohall@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/kernel/pci_dn.c