netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i40e: Fix error handling in i40e_init_module()
@ 2022-11-16  1:27 Shang XiaoJing
  2022-11-17  9:28 ` Leon Romanovsky
  2022-11-22 13:03 ` [Intel-wired-lan] " G, GurucharanX
  0 siblings, 2 replies; 3+ messages in thread
From: Shang XiaoJing @ 2022-11-16  1:27 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
	pabeni, jeffrey.t.kirsher, shannon.nelson, intel-wired-lan,
	netdev
  Cc: shangxiaojing

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>
---
changes in v2:
- destroy the workqueue in fail path too.
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b5dcd15ced36..b3cb587a2032 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] i40e: Fix error handling in i40e_init_module()
  2022-11-16  1:27 [PATCH v2] i40e: Fix error handling in i40e_init_module() Shang XiaoJing
@ 2022-11-17  9:28 ` Leon Romanovsky
  2022-11-22 13:03 ` [Intel-wired-lan] " G, GurucharanX
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-11-17  9:28 UTC (permalink / raw)
  To: Shang XiaoJing
  Cc: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
	pabeni, jeffrey.t.kirsher, shannon.nelson, intel-wired-lan,
	netdev

On Wed, Nov 16, 2022 at 09:27:25AM +0800, Shang XiaoJing wrote:
> 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>
> ---
> changes in v2:
> - destroy the workqueue in fail path too.
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

The subject line should indicate the target branch and needs
to be [PATCH net v2] ....

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Intel-wired-lan] [PATCH v2] i40e: Fix error handling in i40e_init_module()
  2022-11-16  1:27 [PATCH v2] i40e: Fix error handling in i40e_init_module() Shang XiaoJing
  2022-11-17  9:28 ` Leon Romanovsky
@ 2022-11-22 13:03 ` G, GurucharanX
  1 sibling, 0 replies; 3+ messages in thread
From: G, GurucharanX @ 2022-11-22 13:03 UTC (permalink / raw)
  To: Shang XiaoJing, Brandeburg, Jesse, Nguyen, Anthony L, davem,
	edumazet, kuba, pabeni, jeffrey.t.kirsher, shannon.nelson,
	intel-wired-lan, netdev



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Shang XiaoJing
> Sent: Wednesday, November 16, 2022 6:57 AM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> jeffrey.t.kirsher@intel.com; shannon.nelson@intel.com; intel-wired-
> lan@lists.osuosl.org; netdev@vger.kernel.org
> Cc: shangxiaojing@huawei.com
> Subject: [Intel-wired-lan] [PATCH v2] i40e: Fix error handling in
> i40e_init_module()
> 
> 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>
> ---
> changes in v2:
> - destroy the workqueue in fail path too.
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-22 13:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16  1:27 [PATCH v2] i40e: Fix error handling in i40e_init_module() Shang XiaoJing
2022-11-17  9:28 ` Leon Romanovsky
2022-11-22 13:03 ` [Intel-wired-lan] " G, GurucharanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).