From 97c6f25d5828b497e3e802b1f7c70187c88df623 Mon Sep 17 00:00:00 2001 From: Simon Guo Date: Wed, 7 Mar 2018 16:46:04 +0800 Subject: [PATCH] PCI/hotplug: ppc: correct a php_slot usage after free In pnv_php_unregister_one(), pnv_php_put_slot() might kfree php_slot structure. But there is pci_hp_deregister() after that with php_slot reference. This patch moves pnv_php_put_slot() to the end of function. Signed-off-by: Simon Guo Signed-off-by: Michael Ellerman --- drivers/pci/hotplug/pnv_php.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 23da3046f160..d44100687dfe 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c @@ -919,8 +919,8 @@ static void pnv_php_unregister_one(struct device_node *dn) return; php_slot->state = PNV_PHP_STATE_OFFLINE; - pnv_php_put_slot(php_slot); pci_hp_deregister(&php_slot->slot); + pnv_php_put_slot(php_slot); } static void pnv_php_unregister(struct device_node *dn)