mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Don't forget to relock the TTY after uiomove() returns an error.
Peter Holm just discovered this funny bug inside the TTY code: if uiomove() in ttydisc_write() returns an error, we forget to relock the TTY before jumping out of ttydisc_write(). Fix it by placing tty_unlock() and tty_lock() around uiomove(). Submitted by: pho
This commit is contained in:
parent
d1340303b9
commit
87fe0fa84f
1 changed files with 2 additions and 4 deletions
|
|
@ -460,17 +460,15 @@ ttydisc_write(struct tty *tp, struct uio *uio, int ioflag)
|
|||
MPASS(oblen == 0);
|
||||
|
||||
/* Step 1: read data. */
|
||||
|
||||
tty_unlock(tp);
|
||||
|
||||
obstart = ob;
|
||||
nlen = MIN(uio->uio_resid, sizeof ob);
|
||||
tty_unlock(tp);
|
||||
error = uiomove(ob, nlen, uio);
|
||||
tty_lock(tp);
|
||||
if (error != 0)
|
||||
break;
|
||||
oblen = nlen;
|
||||
|
||||
tty_lock(tp);
|
||||
if (tty_gone(tp)) {
|
||||
error = ENXIO;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue