[Skiboot] [PATCH] core/pci: Fix mem-leak on fast-reboot

Andrew Donnellan andrew.donnellan at au1.ibm.com
Thu Jul 20 17:36:44 AEST 2017


On 20/07/17 16:52, Matt Brown wrote:
> Fast-reboot has a memory leak which causes the system to crash after about
> 250 fast-reboots. The patch fixes the memory leak.
> The cause of the leak was the pci_device's being freed, without freeing
> the pci_slot within it.
>
> Signed-off-by: Matt Brown <matthew.brown.dev at gmail.com>
> ---
>  core/pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/core/pci.c b/core/pci.c
> index cc18db1..c1084b5 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -1640,6 +1640,7 @@ static void __pci_reset(struct list_head *list)
>  	while ((pd = list_pop(list, struct pci_device, link)) != NULL) {
>  		__pci_reset(&pd->children);
>  		dt_free(pd->dn);
> +		free(pd->slot);

The other place in pci.c that calls free(pd->slot) null-checks it first, 
is it guaranteed that we'll have pd->slot here?

>  		free(pd);
>  	}
>  }
>

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Skiboot mailing list