|
@@ -1323,6 +1323,9 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
|
|
"%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
|
|
"%s: %s driver does not set tty->port. This will crash the kernel later. Fix the driver!\n",
|
|
__func__, tty->driver->name);
|
|
__func__, tty->driver->name);
|
|
|
|
|
|
|
|
+ retval = tty_ldisc_lock(tty, 5 * HZ);
|
|
|
|
+ if (retval)
|
|
|
|
+ goto err_release_lock;
|
|
tty->port->itty = tty;
|
|
tty->port->itty = tty;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1333,6 +1336,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx)
|
|
retval = tty_ldisc_setup(tty, tty->link);
|
|
retval = tty_ldisc_setup(tty, tty->link);
|
|
if (retval)
|
|
if (retval)
|
|
goto err_release_tty;
|
|
goto err_release_tty;
|
|
|
|
+ tty_ldisc_unlock(tty);
|
|
/* Return the tty locked so that it cannot vanish under the caller */
|
|
/* Return the tty locked so that it cannot vanish under the caller */
|
|
return tty;
|
|
return tty;
|
|
|
|
|
|
@@ -1345,9 +1349,11 @@ err_module_put:
|
|
|
|
|
|
/* call the tty release_tty routine to clean out this slot */
|
|
/* call the tty release_tty routine to clean out this slot */
|
|
err_release_tty:
|
|
err_release_tty:
|
|
- tty_unlock(tty);
|
|
|
|
|
|
+ tty_ldisc_unlock(tty);
|
|
tty_info_ratelimited(tty, "ldisc open failed (%d), clearing slot %d\n",
|
|
tty_info_ratelimited(tty, "ldisc open failed (%d), clearing slot %d\n",
|
|
retval, idx);
|
|
retval, idx);
|
|
|
|
+err_release_lock:
|
|
|
|
+ tty_unlock(tty);
|
|
release_tty(tty, idx);
|
|
release_tty(tty, idx);
|
|
return ERR_PTR(retval);
|
|
return ERR_PTR(retval);
|
|
}
|
|
}
|