[PATCH] powerpc/eeh: Fix kernel crash when passing through VF

Michael Ellerman mpe at ellerman.id.au
Tue Sep 16 14:03:56 EST 2014


On Mon, 2014-09-15 at 16:08 +0800, Wei Yang wrote:
> This patch introduces a marco to convert eeh_dev to eeh_pe. By doing so, it
> will prevent converting with NULL pointer.
> 
> Signed-off-by: Wei Yang <weiyang at linux.vnet.ibm.com>
> Acked-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
> 
> V2 -> V3:
>    1. rebased on 3.17-rc4
>    2. introduce a marco
>    3. use this marco in several other places

Macro :)

> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
> index 59a64f8..0f1b637 100644
> --- a/arch/powerpc/kernel/eeh.c
> +++ b/arch/powerpc/kernel/eeh.c
> @@ -410,7 +410,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
>  	}
>  	dn = eeh_dev_to_of_node(edev);
>  	dev = eeh_dev_to_pci_dev(edev);
> -	pe = edev->pe;
> +	pe = eeh_dev_to_pe(edev);

This looks good, but ..

> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index fd03e819..9656f92 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1824,6 +1824,11 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
>  {
>  	return pdev->dev.archdata.edev;
>  }
> +
> +static inline struct eeh_pe *eeh_dev_to_pe(struct eeh_dev* edev)
> +{
> +	return edev ? edev->pe : NULL;
> +}
>  #endif

Why is it in linux/pci.h ? It's powerpc specific, it should be in arch/powerpc/include/asm/pci.h

cheers




More information about the Linuxppc-dev mailing list