]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
igb: Fix potential invalid memory access in igb_init_module()
authorYuan Can <yuancan@huawei.com>
Wed, 23 Oct 2024 12:10:48 +0000 (20:10 +0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 3 Dec 2024 18:11:53 +0000 (10:11 -0800)
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>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igb/igb_main.c

index 08578980b651802c191c0ec9be050810d6a93844..288a4bb2683a92fae7b75bc967bfb85fe13270ff 100644 (file)
@@ -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;
 }