Commit 968876cc authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET]: More reasonable error handling in SLIP driver unload.

parent d2fc0e5d
...@@ -1381,27 +1381,23 @@ static void __exit slip_exit(void) ...@@ -1381,27 +1381,23 @@ static void __exit slip_exit(void)
local_bh_enable(); local_bh_enable();
} while (busy && time_before(jiffies, timeout)); } while (busy && time_before(jiffies, timeout));
busy = 0;
for (i = 0; i < slip_maxdev; i++) { for (i = 0; i < slip_maxdev; i++) {
struct slip_ctrl *slc = slip_ctrls[i]; struct slip_ctrl *slc = slip_ctrls[i];
if (slc) { if (slc) {
unregister_netdev(&slc->dev); unregister_netdev(&slc->dev);
if (slc->ctrl.tty) { if (slc->ctrl.tty) {
printk(KERN_ERR "%s: tty discipline is still running\n", slc->dev.name); printk(KERN_ERR "%s: tty discipline is still running\n", slc->dev.name);
/* Pin module forever */ /* Intentionally leak the control block. */
MOD_INC_USE_COUNT; } else {
busy++; sl_free_bufs(&slc->ctrl);
continue; kfree(slc);
} }
sl_free_bufs(&slc->ctrl);
kfree(slc);
slip_ctrls[i] = NULL; slip_ctrls[i] = NULL;
} }
} }
if (!busy) {
kfree(slip_ctrls); kfree(slip_ctrls);
slip_ctrls = NULL; slip_ctrls = NULL;
}
} }
if ((i = tty_register_ldisc(N_SLIP, NULL))) if ((i = tty_register_ldisc(N_SLIP, NULL)))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment