drbd: fix NULL pointer deref in module init error path
If we want to iterate over the (as of yet still empty) list in the cleanup path, we need to initialize the list before the first goto fail. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
7badfb1c34
commit
69babf05cb
|
@ -2750,13 +2750,6 @@ int __init drbd_init(void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = drbd_genl_register();
|
|
||||||
if (err) {
|
|
||||||
printk(KERN_ERR "drbd: unable to register generic netlink family\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
register_reboot_notifier(&drbd_notifier);
|
register_reboot_notifier(&drbd_notifier);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2767,6 +2760,15 @@ int __init drbd_init(void)
|
||||||
drbd_proc = NULL; /* play safe for drbd_cleanup */
|
drbd_proc = NULL; /* play safe for drbd_cleanup */
|
||||||
idr_init(&minors);
|
idr_init(&minors);
|
||||||
|
|
||||||
|
rwlock_init(&global_state_lock);
|
||||||
|
INIT_LIST_HEAD(&drbd_tconns);
|
||||||
|
|
||||||
|
err = drbd_genl_register();
|
||||||
|
if (err) {
|
||||||
|
printk(KERN_ERR "drbd: unable to register generic netlink family\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
err = drbd_create_mempools();
|
err = drbd_create_mempools();
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -2778,9 +2780,6 @@ int __init drbd_init(void)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
rwlock_init(&global_state_lock);
|
|
||||||
INIT_LIST_HEAD(&drbd_tconns);
|
|
||||||
|
|
||||||
retry.wq = create_singlethread_workqueue("drbd-reissue");
|
retry.wq = create_singlethread_workqueue("drbd-reissue");
|
||||||
if (!retry.wq) {
|
if (!retry.wq) {
|
||||||
printk(KERN_ERR "drbd: unable to create retry workqueue\n");
|
printk(KERN_ERR "drbd: unable to create retry workqueue\n");
|
||||||
|
|
Loading…
Reference in New Issue