[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1103231040550.1463@ja.ssi.bg>
Date: Wed, 23 Mar 2011 10:49:53 +0200 (EET)
From: Julian Anastasov <ja@....bg>
To: Jiri Slaby <jslaby@...e.cz>
cc: Greg Kroah-Hartman <gregkh@...e.de>, linux-kernel@...r.kernel.org,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Jiri Slaby <jirislaby@...il.com>
Subject: Re: [PATCH] tty: fix tty->ldisc leak on ENODEV from driver install
Hello,
On Wed, 23 Mar 2011, Jiri Slaby wrote:
>> --- linux-2.6.38/drivers/tty/tty_io.c
>> +++ linux-2.6.38/drivers/tty/tty_io.c
>> @@ -188,6 +188,7 @@ void free_tty_struct(struct tty_struct *
>> put_device(tty->dev);
>> kfree(tty->write_buf);
>> tty_buffer_free_all(tty);
>> + kfree(tty->ldisc);
>
> We should not mess up with ldisc here. We should call something like
> tty_ldisc_deinit from tty_init_dev on fail path. The deinit should drop
> the reference (call put_ldisc). Or maybe even deinitialize_tty_struct ->
> tty_ldisc_deinit -> put_ldisc).
>
> Note that your way you do not drop the module refcount of ld ops.
Right, that is what I found before going to sleep.
>From the visible functions I see that currently only
tty_ldisc_deref does exactly what we need. But I suspect
it should be used for other purposes. I assume the authors
have a better idea what to do here. Let me know if I need
to test a better patch.
>> kfree(tty);
>> }
>
> regards,
> --
> js
> suse labs
Regards
--
Julian Anastasov <ja@....bg>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists