]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i40e: Fix error handling in i40e_init_module()
authorShang XiaoJing <shangxiaojing@huawei.com>
Wed, 16 Nov 2022 01:27:25 +0000 (09:27 +0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 23 Nov 2022 16:36:54 +0000 (08:36 -0800)
i40e_init_module() won't free the debugfs directory created by
i40e_dbg_init() when pci_register_driver() failed. Add fail path to
call i40e_dbg_exit() to remove the debugfs entries to prevent the bug.

i40e: Intel(R) Ethernet Connection XL710 Network Driver
i40e: Copyright (c) 2013 - 2019 Intel Corporation.
debugfs: Directory 'i40e' with parent '/' already present!

Fixes: 41c445ff0f48 ("i40e: main driver core")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index b5dcd15ced3644a5441299bfd30b4f9a66ef7f71..b3cb587a20326bb4bba6b182112684ec764122e2 100644 (file)
@@ -16644,6 +16644,8 @@ static struct pci_driver i40e_driver = {
  **/
 static int __init i40e_init_module(void)
 {
+       int err;
+
        pr_info("%s: %s\n", i40e_driver_name, i40e_driver_string);
        pr_info("%s: %s\n", i40e_driver_name, i40e_copyright);
 
@@ -16661,7 +16663,14 @@ static int __init i40e_init_module(void)
        }
 
        i40e_dbg_init();
-       return pci_register_driver(&i40e_driver);
+       err = pci_register_driver(&i40e_driver);
+       if (err) {
+               destroy_workqueue(i40e_wq);
+               i40e_dbg_exit();
+               return err;
+       }
+
+       return 0;
 }
 module_init(i40e_init_module);