netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] igb: Fix potential invalid memory access in igb_init_module()
@ 2024-10-23 12:10 Yuan Can
  2024-10-24 13:27 ` Simon Horman
  2024-11-19 17:47 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan Can @ 2024-10-23 12:10 UTC (permalink / raw)
  To: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
	edumazet, kuba, pabeni, alexander.h.duyck, intel-wired-lan,
	netdev
  Cc: yuancan

The pci_register_driver() can fail and when this happened, the dca_notifier
needs to be unregistered, otherwise the dca_notifier can be called when
igb fails to install, resulting to invalid memory access.

Fixes: bbd98fe48a43 ("igb: Fix DCA errors and do not use context index for 82576")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
Changes since v1:
- Change fix tag to bbd98fe48a43.
- Change target branch to net.
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index f1d088168723..18284a838e24 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -637,6 +637,10 @@ static int __init igb_init_module(void)
 	dca_register_notify(&dca_notifier);
 #endif
 	ret = pci_register_driver(&igb_driver);
+#ifdef CONFIG_IGB_DCA
+	if (ret)
+		dca_unregister_notify(&dca_notifier);
+#endif
 	return ret;
 }
 
-- 
2.17.1


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

end of thread, other threads:[~2024-11-19 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 12:10 [PATCH net v2] igb: Fix potential invalid memory access in igb_init_module() Yuan Can
2024-10-24 13:27 ` Simon Horman
2024-11-19 17:47 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy

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