Commit 8cfa238a authored by Shang XiaoJing's avatar Shang XiaoJing Committed by Tony Nguyen

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 f276e002
("usb: u132-hcd: fix resource leak")

Fixes: 40a13e24 ("ixgbevf: Use a private workqueue to avoid certain possible hangs")
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: default avatarSaeed Mahameed <saeed@kernel.org>
Tested-by: default avatarKonrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 748064b5
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment