* [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
@ 2022-12-27 21:15 Tanmay Bhushan
2022-12-28 6:58 ` Jason Wang
2023-01-27 10:37 ` Michael S. Tsirkin
0 siblings, 2 replies; 7+ messages in thread
From: Tanmay Bhushan @ 2022-12-27 21:15 UTC (permalink / raw)
To: Zhu Lingshan, Michael S. Tsirkin, Jason Wang, virtualization,
linux-kernel
From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <007047221b@gmail.com>
Date: Tue, 27 Dec 2022 22:02:16 +0100
Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
ifcvf_mgmt_dev leaks memory if it is not freed before
returning. Call is made to correct return statement
so memory does not leak. ifcvf_init_hw does not take
care of this so it is needed to do it here.
Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
---
drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
b/drivers/vdpa/ifcvf/ifcvf_main.c
index f9c0044c6442..44b29289aa19 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
struct pci_device_id *id)
ret = ifcvf_init_hw(vf, pdev);
if (ret) {
IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
- return ret;
+ goto err;
}
for (i = 0; i < vf->nr_vring; i++)
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
2022-12-27 21:15 [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails Tanmay Bhushan
@ 2022-12-28 6:58 ` Jason Wang
2023-01-27 10:37 ` Michael S. Tsirkin
1 sibling, 0 replies; 7+ messages in thread
From: Jason Wang @ 2022-12-28 6:58 UTC (permalink / raw)
To: Tanmay Bhushan; +Cc: virtualization, linux-kernel, Michael S. Tsirkin
On Wed, Dec 28, 2022 at 5:15 AM Tanmay Bhushan <007047221b@gmail.com> wrote:
>
> From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
> From: Tanmay Bhushan <007047221b@gmail.com>
> Date: Tue, 27 Dec 2022 22:02:16 +0100
> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>
> ifcvf_mgmt_dev leaks memory if it is not freed before
> returning. Call is made to correct return statement
> so memory does not leak. ifcvf_init_hw does not take
> care of this so it is needed to do it here.
>
> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
> ---
> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
> b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f9c0044c6442..44b29289aa19 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
> struct pci_device_id *id)
> ret = ifcvf_init_hw(vf, pdev);
> if (ret) {
> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
> - return ret;
> + goto err;
> }
>
> for (i = 0; i < vf->nr_vring; i++)
> --
> 2.34.1
>
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
@ 2022-12-28 6:58 ` Jason Wang
0 siblings, 0 replies; 7+ messages in thread
From: Jason Wang @ 2022-12-28 6:58 UTC (permalink / raw)
To: Tanmay Bhushan
Cc: Zhu Lingshan, Michael S. Tsirkin, virtualization, linux-kernel
On Wed, Dec 28, 2022 at 5:15 AM Tanmay Bhushan <007047221b@gmail.com> wrote:
>
> From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
> From: Tanmay Bhushan <007047221b@gmail.com>
> Date: Tue, 27 Dec 2022 22:02:16 +0100
> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>
> ifcvf_mgmt_dev leaks memory if it is not freed before
> returning. Call is made to correct return statement
> so memory does not leak. ifcvf_init_hw does not take
> care of this so it is needed to do it here.
>
> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
> ---
> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
> b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f9c0044c6442..44b29289aa19 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
> struct pci_device_id *id)
> ret = ifcvf_init_hw(vf, pdev);
> if (ret) {
> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
> - return ret;
> + goto err;
> }
>
> for (i = 0; i < vf->nr_vring; i++)
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
2022-12-28 6:58 ` Jason Wang
@ 2022-12-29 4:25 ` Zhu, Lingshan
-1 siblings, 0 replies; 7+ messages in thread
From: Zhu, Lingshan @ 2022-12-29 4:25 UTC (permalink / raw)
To: Jason Wang, Tanmay Bhushan
Cc: Michael S. Tsirkin, virtualization, linux-kernel
On 12/28/2022 2:58 PM, Jason Wang wrote:
> On Wed, Dec 28, 2022 at 5:15 AM Tanmay Bhushan <007047221b@gmail.com> wrote:
>> From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
>> From: Tanmay Bhushan <007047221b@gmail.com>
>> Date: Tue, 27 Dec 2022 22:02:16 +0100
>> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>>
>> ifcvf_mgmt_dev leaks memory if it is not freed before
>> returning. Call is made to correct return statement
>> so memory does not leak. ifcvf_init_hw does not take
>> care of this so it is needed to do it here.
>>
>> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
> Acked-by: Jason Wang <jasowang@redhat.com>
>
> Thanks
Acked-by: Zhu Lingshan <lingshan.zhu@intel.com>
Thanks
>
>> ---
>> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
>> b/drivers/vdpa/ifcvf/ifcvf_main.c
>> index f9c0044c6442..44b29289aa19 100644
>> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
>> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
>> struct pci_device_id *id)
>> ret = ifcvf_init_hw(vf, pdev);
>> if (ret) {
>> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
>> - return ret;
>> + goto err;
>> }
>>
>> for (i = 0; i < vf->nr_vring; i++)
>> --
>> 2.34.1
>>
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
@ 2022-12-29 4:25 ` Zhu, Lingshan
0 siblings, 0 replies; 7+ messages in thread
From: Zhu, Lingshan @ 2022-12-29 4:25 UTC (permalink / raw)
To: Jason Wang, Tanmay Bhushan
Cc: virtualization, linux-kernel, Michael S. Tsirkin
On 12/28/2022 2:58 PM, Jason Wang wrote:
> On Wed, Dec 28, 2022 at 5:15 AM Tanmay Bhushan <007047221b@gmail.com> wrote:
>> From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
>> From: Tanmay Bhushan <007047221b@gmail.com>
>> Date: Tue, 27 Dec 2022 22:02:16 +0100
>> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>>
>> ifcvf_mgmt_dev leaks memory if it is not freed before
>> returning. Call is made to correct return statement
>> so memory does not leak. ifcvf_init_hw does not take
>> care of this so it is needed to do it here.
>>
>> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
> Acked-by: Jason Wang <jasowang@redhat.com>
>
> Thanks
Acked-by: Zhu Lingshan <lingshan.zhu@intel.com>
Thanks
>
>> ---
>> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
>> b/drivers/vdpa/ifcvf/ifcvf_main.c
>> index f9c0044c6442..44b29289aa19 100644
>> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
>> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
>> struct pci_device_id *id)
>> ret = ifcvf_init_hw(vf, pdev);
>> if (ret) {
>> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
>> - return ret;
>> + goto err;
>> }
>>
>> for (i = 0; i < vf->nr_vring; i++)
>> --
>> 2.34.1
>>
>>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
2022-12-27 21:15 [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails Tanmay Bhushan
@ 2023-01-27 10:37 ` Michael S. Tsirkin
2023-01-27 10:37 ` Michael S. Tsirkin
1 sibling, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2023-01-27 10:37 UTC (permalink / raw)
To: Tanmay Bhushan; +Cc: linux-kernel, virtualization
On Tue, Dec 27, 2022 at 10:15:25PM +0100, Tanmay Bhushan wrote:
> >From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
> From: Tanmay Bhushan <007047221b@gmail.com>
> Date: Tue, 27 Dec 2022 22:02:16 +0100
> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>
> ifcvf_mgmt_dev leaks memory if it is not freed before
> returning. Call is made to correct return statement
> so memory does not leak. ifcvf_init_hw does not take
> care of this so it is needed to do it here.
>
> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
> ---
> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
> b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f9c0044c6442..44b29289aa19 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
> struct pci_device_id *id)
BTW your patch was mangled but I fixed it.
> ret = ifcvf_init_hw(vf, pdev);
> if (ret) {
> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
> - return ret;
> + goto err;
> }
>
> for (i = 0; i < vf->nr_vring; i++)
> --
> 2.34.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
@ 2023-01-27 10:37 ` Michael S. Tsirkin
0 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2023-01-27 10:37 UTC (permalink / raw)
To: Tanmay Bhushan; +Cc: Zhu Lingshan, Jason Wang, virtualization, linux-kernel
On Tue, Dec 27, 2022 at 10:15:25PM +0100, Tanmay Bhushan wrote:
> >From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
> From: Tanmay Bhushan <007047221b@gmail.com>
> Date: Tue, 27 Dec 2022 22:02:16 +0100
> Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
>
> ifcvf_mgmt_dev leaks memory if it is not freed before
> returning. Call is made to correct return statement
> so memory does not leak. ifcvf_init_hw does not take
> care of this so it is needed to do it here.
>
> Signed-off-by: Tanmay Bhushan <007047221b@gmail.com>
> ---
> drivers/vdpa/ifcvf/ifcvf_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c
> b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f9c0044c6442..44b29289aa19 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const
> struct pci_device_id *id)
BTW your patch was mangled but I fixed it.
> ret = ifcvf_init_hw(vf, pdev);
> if (ret) {
> IFCVF_ERR(pdev, "Failed to init IFCVF hw\n");
> - return ret;
> + goto err;
> }
>
> for (i = 0; i < vf->nr_vring; i++)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-27 10:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27 21:15 [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails Tanmay Bhushan
2022-12-28 6:58 ` Jason Wang
2022-12-28 6:58 ` Jason Wang
2022-12-29 4:25 ` Zhu, Lingshan
2022-12-29 4:25 ` Zhu, Lingshan
2023-01-27 10:37 ` Michael S. Tsirkin
2023-01-27 10:37 ` Michael S. Tsirkin
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.