diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 10:39:13 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 09:51:41 -0700 |
commit | 452a00d2ee288f2cbc36f676edd06cb14d2878c1 (patch) | |
tree | c8251c73924a6ac9b174bc557357bfeff0c8d1a8 /drivers/s390/char | |
parent | f4d2a6c2096b764decb20070b1bf4356de9144a8 (diff) | |
download | kernel-crypto-452a00d2ee288f2cbc36f676edd06cb14d2878c1.tar.gz kernel-crypto-452a00d2ee288f2cbc36f676edd06cb14d2878c1.tar.xz kernel-crypto-452a00d2ee288f2cbc36f676edd06cb14d2878c1.zip |
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 <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r-- | drivers/s390/char/fs3270.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index d18e6d2e0b4..3ef5425d0eb 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c @@ -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. */ |