lkml.org 
[lkml]   [2008]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 36/76] tty: Make get_current_tty use a kref
On Sun, Oct 05, 2008 at 05:10:42PM +0100, Alan Cox wrote:
> 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]
>

[...]

> diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
> index d18e6d2..3ef5425 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);

Should'nt mutex_unlock() be kept?

Louis

> 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. */

--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-10-06 12:39    [W:0.227 / U:0.656 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site