* [PATCH -next] PCI: endpoint: Fix missing unlock on error in pci_epf_add_vepf()
@ 2021-08-19 8:06 Wei Yongjun
2021-08-19 12:37 ` Kishon Vijay Abraham I
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2021-08-19 8:06 UTC (permalink / raw)
To: weiyongjun1, Kishon Vijay Abraham I, Lorenzo Pieralisi, Bjorn Helgaas
Cc: linux-pci, kernel-janitors, Hulk Robot
Add the missing unlock before return from function pci_epf_add_vepf()
in the error handling case.
Fixes: b64215ff2b5e ("PCI: endpoint: Add support to add virtual function in endpoint core")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/pci/endpoint/pci-epf-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index ec286ee5d04c..8aea16380870 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -200,8 +200,10 @@ int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
mutex_lock(&epf_pf->lock);
vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
BITS_PER_LONG);
- if (vfunc_no >= BITS_PER_LONG)
+ if (vfunc_no >= BITS_PER_LONG) {
+ mutex_unlock(&epf_pf->lock);
return -EINVAL;
+ }
set_bit(vfunc_no, &epf_pf->vfunction_num_map);
epf_vf->vfunc_no = vfunc_no;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] PCI: endpoint: Fix missing unlock on error in pci_epf_add_vepf()
2021-08-19 8:06 [PATCH -next] PCI: endpoint: Fix missing unlock on error in pci_epf_add_vepf() Wei Yongjun
@ 2021-08-19 12:37 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 2+ messages in thread
From: Kishon Vijay Abraham I @ 2021-08-19 12:37 UTC (permalink / raw)
To: Wei Yongjun, Lorenzo Pieralisi, Bjorn Helgaas
Cc: linux-pci, kernel-janitors, Hulk Robot
Hi Wei,
On 19/08/21 1:36 pm, Wei Yongjun wrote:
> Add the missing unlock before return from function pci_epf_add_vepf()
> in the error handling case.
>
> Fixes: b64215ff2b5e ("PCI: endpoint: Add support to add virtual function in endpoint core")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Thanks for the patch. Since I had to resend the series, I squashed this
patch into the original series
https://lore.kernel.org/r/20210819123343.1951-3-kishon@ti.com
Thanks
Kishon
> ---
> drivers/pci/endpoint/pci-epf-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
> index ec286ee5d04c..8aea16380870 100644
> --- a/drivers/pci/endpoint/pci-epf-core.c
> +++ b/drivers/pci/endpoint/pci-epf-core.c
> @@ -200,8 +200,10 @@ int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
> mutex_lock(&epf_pf->lock);
> vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
> BITS_PER_LONG);
> - if (vfunc_no >= BITS_PER_LONG)
> + if (vfunc_no >= BITS_PER_LONG) {
> + mutex_unlock(&epf_pf->lock);
> return -EINVAL;
> + }
>
> set_bit(vfunc_no, &epf_pf->vfunction_num_map);
> epf_vf->vfunc_no = vfunc_no;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-19 12:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 8:06 [PATCH -next] PCI: endpoint: Fix missing unlock on error in pci_epf_add_vepf() Wei Yongjun
2021-08-19 12:37 ` Kishon Vijay Abraham I
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.