提交 7b7cdc73 编写于 作者: S Shang XiaoJing 提交者: sanglipeng

i40e: Fix error handling in i40e_init_module()

stable inclusion
from stable-v5.10.158
commit dd425cec79baeaad2f93b61647bb41b246856914
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7NTXH

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=dd425cec79baeaad2f93b61647bb41b246856914

--------------------------------

[ Upstream commit 479dd061 ]

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: 41c445ff ("i40e: main driver core")
Signed-off-by: NShang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 65b9da38
...@@ -15972,6 +15972,8 @@ static struct pci_driver i40e_driver = { ...@@ -15972,6 +15972,8 @@ static struct pci_driver i40e_driver = {
**/ **/
static int __init i40e_init_module(void) 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_driver_string);
pr_info("%s: %s\n", i40e_driver_name, i40e_copyright); pr_info("%s: %s\n", i40e_driver_name, i40e_copyright);
...@@ -15989,7 +15991,14 @@ static int __init i40e_init_module(void) ...@@ -15989,7 +15991,14 @@ static int __init i40e_init_module(void)
} }
i40e_dbg_init(); 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); module_init(i40e_init_module);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册