mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
tty: Make get_current_tty use a kref
We now return a kref covered tty reference. That ensures the tty structure doesn't go away when you have a return from get_current_tty. This is not enough to protect you from most of the resources being freed behind your back - yet. [Updated to include fixes for SELinux problems found by Andrew Morton and an s390 leak found while debugging the former] Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f4d2a6c209
commit
452a00d2ee
4 changed files with 13 additions and 9 deletions
|
|
@ -430,11 +430,12 @@ fs3270_open(struct inode *inode, struct file *filp)
|
|||
mutex_lock(&tty_mutex);
|
||||
tty = get_current_tty();
|
||||
if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) {
|
||||
mutex_unlock(&tty_mutex);
|
||||
tty_kref_put(tty);
|
||||
rc = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
minor = tty->index + RAW3270_FIRSTMINOR;
|
||||
tty_kref_put(tty);
|
||||
mutex_unlock(&tty_mutex);
|
||||
}
|
||||
/* Check if some other program is already using fullscreen mode. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue