linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI/hotplug: ppc: correct a php_slot usage after free
@ 2018-03-07  8:46 wei.guo.simon
  2018-03-14  9:28 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: wei.guo.simon @ 2018-03-07  8:46 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Benjamin Herrenschmidt, linux-pci, linux-kernel, Simon Guo

From: Simon Guo <wei.guo.simon@gmail.com>

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>
---
 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 74f6a17..eb60692e 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -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)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: PCI/hotplug: ppc: correct a php_slot usage after free
  2018-03-07  8:46 [PATCH] PCI/hotplug: ppc: correct a php_slot usage after free wei.guo.simon
@ 2018-03-14  9:28 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-03-14  9:28 UTC (permalink / raw)
  To: wei.guo.simon, linuxppc-dev; +Cc: Simon Guo, linux-kernel, linux-pci

On Wed, 2018-03-07 at 08:46:04 UTC, wei.guo.simon@gmail.com wrote:
> From: Simon Guo <wei.guo.simon@gmail.com>
> 
> 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>

Applied to powerpc next, thanks.

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

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-14  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07  8:46 [PATCH] PCI/hotplug: ppc: correct a php_slot usage after free wei.guo.simon
2018-03-14  9:28 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).