ixgbevf: Fix resource leak in ixgbevf_init_module()
Subsystems (3)
PATCH 1/1 ixgbevf: Fix resource leak in ixgbevf_init_module()
ixgbevf_init_module() won't destroy the workqueue created by create_singlethread_workqueue() when pci_register_driver() failed. Add destroy_workqueue() in fail path to prevent the resource leak.
Similar to the handling of u132_hcd_init in commit f276e002793c ("usb: u132-hcd: fix resource leak")
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +9 -1
@@ -4869,6 +4869,8 @@ static struct pci_driver ixgbevf_driver = {**/ static int __init ixgbevf_init_module (void ) { +int err; +pr_info ("%s\n" , ixgbevf_driver_string);pr_info ("%s\n" , ixgbevf_copyright); ixgbevf_wq =create_singlethread_workqueue (ixgbevf_driver_name);
@@ -4877,7 +4879,13 @@ static int __init ixgbevf_init_module(void)return -ENOMEM ; } -return pci_register_driver (&ixgbevf_driver); + err =pci_register_driver (&ixgbevf_driver); +if (err) { +destroy_workqueue (ixgbevf_wq); +return err; + } + +return 0 ; }module_init (ixgbevf_init_module);
Signature · 1 line
2.17.1
Quoted 9 lines · Shang XiaoJing
ixgbevf_init_module()won't destroy the workqueue created bycreate_singlethread_workqueue()whenpci_register_driver()failed. Adddestroy_workqueue()in fail path to prevent the resource leak.Similar to the handling of
u132_hcd_initin commitf276e002793c("usb: u132-hcd: fix resource leak")Fixes 40a13e2493c9 ("ixgbevf: Use a private workqueue to avoid certain possible hangs")Signed-off-by Shang XiaoJing <[email protected]>
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c static struct pci_driver ixgbevf_driver = {
Quoted 35 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Shang XiaoJing
Sent: Monday, November 14, 2022 3:58 AM
To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Rustad, Mark D <[email protected]>; intel- [email protected]; [email protected]
Cc: [email protected]
Subject: [Intel-wired-lan] [PATCH] ixgbevf: Fix resource leak inixgbevf_init_module()
ixgbevf_init_module()won't destroy the workqueue created bycreate_singlethread_workqueue()whenpci_register_driver()failed. Adddestroy_workqueue()in fail path to prevent the resource leak.Similar to the handling of
u132_hcd_initin commitf276e002793c("usb: u132-hcd: fix resource leak")Fixes 40a13e2493c9 ("ixgbevf: Use a private workqueue to avoid certain possiblehangs")
Signed-off-by Shang XiaoJing <[email protected]>--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +0
-0@@ -4869,6 +4869,8 @@ static struct pci_driver ixgbevf_driver = {
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan