vdpa: ifcvf: Do proper cleanup if IFCVF init fails
Subsystems (2)
PATCH 1/1 vdpa: ifcvf: Do proper cleanup if IFCVF init fails
From 7eae04667ddaac8baa4812d48ef2c942cedef946 Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <[email protected]>
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.
--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0
b/drivers/vdpa/ifcvf/ifcvf_main.c
index f9c0044c6442..44b29289aa19 100644
drivers/vdpa/ifcvf/ifcvf_main.c +0 -0
@@ -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++)
Signature · 1 line
2.34.1
Quoted 6 lines · Tanmay Bhushan
From
7eae04667ddaac8baa4812d48ef2c942cedef946Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <[email protected]>
Date: Tue, 27 Dec 2022 22:02:16 +0100
Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
Quoted 6 lines
ifcvf_mgmt_devleaks memory if it is not freed before returning. Call is made to correct return statement so memory does not leak.ifcvf_init_hwdoes not take care of this so it is needed to do it here.Signed-off-by Tanmay Bhushan <[email protected]>
Thanks
Quoted 19 lines
--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/ifcvf/ifcvf_main.c +1
-1@@ -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++)
Quoted 4 lines
--
2.34.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Zhu, Lingshan
Acked-byQuoted 11 lines · Jason Wang
Quoted 10 lines · Tanmay Bhushan
From
7eae04667ddaac8baa4812d48ef2c942cedef946Mon Sep 17 00:00:00 2001
From: Tanmay Bhushan <[email protected]>
Date: Tue, 27 Dec 2022 22:02:16 +0100
Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
ifcvf_mgmt_devleaks memory if it is not freed before returning. Call is made to correct return statement so memory does not leak.ifcvf_init_hwdoes not take care of this so it is needed to do it here.
Quoted 4 lines
Quoted 1 line
Signed-off-by Tanmay Bhushan <[email protected]>Acked-by Jason Wang <[email protected]>Thanks
Thanks
Quoted 19 lines
Quoted 19 lines
--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/ifcvf/ifcvf_main.c +1
-1@@ -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; }
Quoted 5 lines
Quoted 5 lines
for (i = 0; i < vf->nr_vring; i++)--
2.34.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 21 lines · Tanmay Bhushan
Quoted 1 line
From
7eae04667ddaac8baa4812d48ef2c942cedef946Mon Sep 17 00:00:00 2001From: Tanmay Bhushan <[email protected]>
Date: Tue, 27 Dec 2022 22:02:16 +0100
Subject: [PATCH] vdpa: ifcvf: Do proper cleanup if IFCVF init fails
ifcvf_mgmt_devleaks memory if it is not freed before returning. Call is made to correct return statement so memory does not leak.ifcvf_init_hwdoes not take care of this so it is needed to do it here.Signed-off-by Tanmay Bhushan <[email protected]>--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/ifcvf/ifcvf_main.c +0
-0
drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_probe(struct pci_dev *pdev, const · line 849
Quoted 1 line
drivers/vdpa/ifcvf/ifcvf_main.c +0
-0@@ -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.
Quoted 11 lines
drivers/vdpa/ifcvf/ifcvf_main.c +1
-1ret =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++)Signature · 1 line
2.34.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization