ixgbevf: Fix resource leak in ixgbevf_init_module()
authorShang XiaoJing <shangxiaojing@huawei.com>
Mon, 14 Nov 2022 02:57:58 +0000 (10:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:28:39 +0000 (11:28 +0100)
commit7109e941099244cc876a4b3cb7a3ec79f104374a
treee3cb05cf4fa8ab3ccd3432466a961e6cc7f85add
parent196ea810e21ce93c48887ae3c5842626c7216afe
ixgbevf: Fix resource leak in ixgbevf_init_module()

[ Upstream commit 8cfa238a48f34038464b99d0b4825238c2687181 ]

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")

Fixes: 40a13e2493c9 ("ixgbevf: Use a private workqueue to avoid certain possible hangs")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: Saeed Mahameed <saeed@kernel.org>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c