Re: [PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

2016-07-13 Thread Mauricio Faria de Oliveira
On 07/12/2016 08:07 PM, Mauricio Faria de Oliveira wrote: Can you clarify which are the devices that should be tracked w/ krefs to the PHB? Last night I had forgotten about the fundamental point of krefs - track references to pointers - and this answers the question. I'm looking at the

Re: [PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

2016-07-12 Thread Mauricio Faria de Oliveira
Ben, On 07/04/2016 11:55 PM, Benjamin Herrenschmidt wrote: Have you considered instead adding a kref to the PHB and only freeing it when all devices have been freed ? Or it's too hard to tract device creation ? Can you clarify which are the devices that should be tracked w/ krefs to the PHB?

Re: [PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

2016-07-05 Thread Mauricio Faria de Oliveira
On 07/04/2016 11:55 PM, Benjamin Herrenschmidt wrote: Have you considered instead adding a kref to the PHB and only freeing it when all devices have been freed ? Or it's too hard to tract device creation ? Yes, considered it, but felt leery of possibly leaving the PHB unfreed (or block until

Re: [PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

2016-07-04 Thread Benjamin Herrenschmidt
On Mon, 2016-07-04 at 22:44 -0300, Mauricio Faria de Oliveira wrote: > It's possible to hit an oops/crash if pcibios_release_device() accesses the > phb struct and it had been freed earlier -- by pcibios_free_controller() -- > as the memory it pointed to can be reused. > > If after reuse

[PATCH] powerpc: fix oops in pcibios_release_device() after pcibios_free_controller()

2016-07-04 Thread Mauricio Faria de Oliveira
It's possible to hit an oops/crash if pcibios_release_device() accesses the phb struct and it had been freed earlier -- by pcibios_free_controller() -- as the memory it pointed to can be reused. If after reuse 'phb->controller_ops.release_device' is non-NULL it will be called, but it points to an