[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241022063807.37561-1-yuancan@huawei.com>
Date: Tue, 22 Oct 2024 14:38:07 +0800
From: Yuan Can <yuancan@...wei.com>
To: <anthony.l.nguyen@...el.com>, <przemyslaw.kitszel@...el.com>,
<andrew+netdev@...n.ch>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <cramerj@...el.com>,
<shannon.nelson@....com>, <mitch.a.williams@...el.com>, <jgarzik@...hat.com>,
<auke-jan.h.kok@...el.com>, <intel-wired-lan@...ts.osuosl.org>,
<netdev@...r.kernel.org>
CC: <yuancan@...wei.com>
Subject: [PATCH] igb: Fix potential invalid memory access in igb_init_module()
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: fe4506b6a2f9 ("igb: add DCA support")
Signed-off-by: Yuan Can <yuancan@...wei.com>
---
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
Powered by blists - more mailing lists