소스 검색

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 <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Simon Guo 7 년 전
부모
커밋
97c6f25d58
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/pci/hotplug/pnv_php.c

+ 1 - 1
drivers/pci/hotplug/pnv_php.c

@@ -919,8 +919,8 @@ static void pnv_php_unregister_one(struct device_node *dn)
 		return;
 		return;
 
 
 	php_slot->state = PNV_PHP_STATE_OFFLINE;
 	php_slot->state = PNV_PHP_STATE_OFFLINE;
-	pnv_php_put_slot(php_slot);
 	pci_hp_deregister(&php_slot->slot);
 	pci_hp_deregister(&php_slot->slot);
+	pnv_php_put_slot(php_slot);
 }
 }
 
 
 static void pnv_php_unregister(struct device_node *dn)
 static void pnv_php_unregister(struct device_node *dn)