Skip to contentSkip to conversation

PCI/hotplug: ppc: correct a php_slot usage after free

PATCH Applied [email protected] 2 participants 2 messages Mar 7, 2018 – Mar 14, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/hotplug: ppc: correct a php_slot usage after free

From: Simon Guo <[email protected]>

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.

---
 drivers/pci/hotplug/pnv_php.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/pnv_php.c +1 -1
index 74f6a17..eb60692e 100644
@@ -930,8 +930,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)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · On Wed, 2018-03-07 at 08:46:04 UTC, [email protected] wrote:

From: Simon Guo <[email protected]>

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/97c6f25d5828b497e3e802b1f7c701

cheers