mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Any call of tty_close() with a tty refcount of <= 1 is wrong and we will
free the tty in this case. This is a workaround until the underlaying devfs/tty problems are fixed. MFC after: 1 day
This commit is contained in:
parent
1517bdc897
commit
35dcc318f4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162833
@ -333,7 +333,15 @@ tty_close(struct tty *tp)
|
||||
tp->t_state = 0;
|
||||
knlist_clear(&tp->t_rsel.si_note, 0);
|
||||
knlist_clear(&tp->t_wsel.si_note, 0);
|
||||
ttyrel(tp);
|
||||
/*
|
||||
* Any close with tp->t_refcnt == 1 is wrong and is
|
||||
* an indication of a locking bug somewhere and that
|
||||
* our open call has not been finished properly.
|
||||
* Instead of putting an assert here we skip decrementing
|
||||
* the refcount to work around any problems.
|
||||
*/
|
||||
if (tp->t_refcnt > 1)
|
||||
ttyrel(tp);
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
@ -3068,11 +3076,6 @@ ttyopen(struct cdev *dev, int flag, int mode, struct thread *td)
|
||||
|
||||
tp = dev->si_tty;
|
||||
|
||||
/* XXX It can happen that devfs_open calls us with tp->t_refcnt == 0 */
|
||||
if (tp == NULL || tp->t_refcnt == 0) {
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
s = spltty();
|
||||
/*
|
||||
* We jump to this label after all non-interrupted sleeps to pick
|
||||
|
Loading…
Reference in New Issue
Block a user