mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jiri Slaby <jirislaby@gmail.com>
Subject: Re: [PATCH] tty: fix tty->ldisc leak on ENODEV from driver install
Date: Wed, 23 Mar 2011 10:49:53 +0200 (EET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1103231040550.1463@ja.ssi.bg> (raw)
In-Reply-To: <4D89AB83.3000103@suse.cz>


 	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@ssi.bg>

      reply	other threads:[~2011-03-23  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  0:45 Julian Anastasov
2011-03-23  8:12 ` Jiri Slaby
2011-03-23  8:49   ` Julian Anastasov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1103231040550.1463@ja.ssi.bg \
    --to=ja@ssi.bg \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=jirislaby@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®