mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
tty: Prevent hw state corruption in exclusive mode reopen
Exclusive mode ttys (TTY_EXCLUSIVE) do not allow further reopens; fail the condition before associating the file pointer and calling the driver open() method. Prevents DTR programming when the tty is already in exclusive mode. Reported-by: Shreyas Bethur <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Acked-by: Shreyas Bethur <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
72a3c0e4e6
commit
86f2c00f1d
1 changed files with 3 additions and 4 deletions
|
|
@ -1464,6 +1464,9 @@ static int tty_reopen(struct tty_struct *tty)
|
|||
driver->subtype == PTY_TYPE_MASTER)
|
||||
return -EIO;
|
||||
|
||||
if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN))
|
||||
return -EBUSY;
|
||||
|
||||
tty->count++;
|
||||
|
||||
WARN_ON(!tty->ldisc);
|
||||
|
|
@ -2106,10 +2109,6 @@ retry_open:
|
|||
retval = -ENODEV;
|
||||
filp->f_flags = saved_flags;
|
||||
|
||||
if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) &&
|
||||
!capable(CAP_SYS_ADMIN))
|
||||
retval = -EBUSY;
|
||||
|
||||
if (retval) {
|
||||
#ifdef TTY_DEBUG_HANGUP
|
||||
printk(KERN_DEBUG "%s: error %d in opening %s...\n", __func__,
|
||||
|
|
|
|||
Loading…
Reference in a new issue