Re: [PATCH v3 3/3] PCI: endpoint: Fix API pci_epf_add_vepf() returning -EBUSY error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 10, 2024 at 10:00:20PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>
> pci_epf_add_vepf() will suffer -EBUSY error by steps below:
>
> pci_epf_add_vepf(@epf_pf, @epf_vf)       // add
> pci_epf_remove_vepf(@epf_pf, @epf_vf)   // remove
> pci_epf_add_vepf(@epf_pf, @epf_vf)     // add again, -EBUSY error.

nit: can you align comments to the same column?

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

>
> Fix by clearing @epf_vf->epf_pf in pci_epf_remove_vepf().
>
> Fixes: 1cf362e907f3 ("PCI: endpoint: Add support to add virtual function in endpoint core")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
> ---
>  drivers/pci/endpoint/pci-epf-core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
> index 8fa2797d4169a9f21136bbf73daa818da6c4ac49..50bc2892a36c54aa82c819ac5a9c99e9155d92c1 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -202,6 +202,7 @@ void pci_epf_remove_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
>
>  	mutex_lock(&epf_pf->lock);
>  	clear_bit(epf_vf->vfunc_no, &epf_pf->vfunction_num_map);
> +	epf_vf->epf_pf = NULL;
>  	list_del(&epf_vf->list);
>  	mutex_unlock(&epf_pf->lock);
>  }
>
> --
> 2.34.1
>




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux