mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
netxen: unregister notifiers if PCI registration fails
netxen_init_module() registers the netdevice and inetaddr notifiers before registering the PCI driver. If pci_register_driver() fails, the function returns the error directly and leaves both notifiers registered. That leaves notifier callbacks installed for a module that failed to load. Mirror the module exit path on this failure and unregister the notifiers before returning the error. Cc: stable+noautosel@kernel.org # untested fix to unlikely driver error path Signed-off-by: Can Peng <pengcan@kylinos.cn> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Link: https://patch.msgid.link/20260728032046.121631-2-pengcan@kylinos.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d661abdc30
commit
e8aaf6ba33
|
|
@ -3447,13 +3447,24 @@ static struct pci_driver netxen_driver = {
|
|||
|
||||
static int __init netxen_init_module(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
printk(KERN_INFO "%s\n", netxen_nic_driver_string);
|
||||
|
||||
#ifdef CONFIG_INET
|
||||
register_netdevice_notifier(&netxen_netdev_cb);
|
||||
register_inetaddr_notifier(&netxen_inetaddr_cb);
|
||||
#endif
|
||||
return pci_register_driver(&netxen_driver);
|
||||
|
||||
ret = pci_register_driver(&netxen_driver);
|
||||
#ifdef CONFIG_INET
|
||||
if (ret) {
|
||||
unregister_inetaddr_notifier(&netxen_inetaddr_cb);
|
||||
unregister_netdevice_notifier(&netxen_netdev_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module_init(netxen_init_module);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user