From: Paul Fulghum <paulkf@microgate.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] Introduce tty_unregister_ldisc()
Date: Tue, 31 May 2005 22:38:08 -0500 [thread overview]
Message-ID: <1117597088.5888.18.camel@at2.pipehead.org> (raw)
In-Reply-To: <1117578491.4627.14.camel@at2.pipehead.org>
On Tue, 2005-05-31 at 17:28 -0500, Paul Fulghum wrote:
> An unmodified ldisc driver (externally maintained) will continue to call
> tty_register_ldisc with NULL, but the new behavior will be to set the
> ldisc pointer to NULL but have LDISC_FLAG_DEFINED set.
I was partially wrong.
After Alexey's patch, a NULL new_ldisc is accessed
(not assigned) causing an oops. This is still not
good behavior.
As for the refcount bug, this patch should fix it.
Comments?
--
Paul Fulghum
paulkf@microgate.com
--- linux-2.6.11/drivers/char/tty_io.c 2005-03-02 01:38:10.000000000 -0600
+++ b/drivers/char/tty_io.c 2005-05-31 22:10:41.000000000 -0500
@@ -262,16 +262,16 @@ int tty_register_ldisc(int disc, struct
return -EINVAL;
spin_lock_irqsave(&tty_ldisc_lock, flags);
- if (new_ldisc) {
+ if ((tty_ldiscs[disc].flags & LDISC_FLAG_DEFINED) &&
+ tty_ldiscs[disc].refcount)
+ ret = -EBUSY;
+ else if (new_ldisc) {
tty_ldiscs[disc] = *new_ldisc;
tty_ldiscs[disc].num = disc;
tty_ldiscs[disc].flags |= LDISC_FLAG_DEFINED;
tty_ldiscs[disc].refcount = 0;
} else {
- if(tty_ldiscs[disc].refcount)
- ret = -EBUSY;
- else
- tty_ldiscs[disc].flags &= ~LDISC_FLAG_DEFINED;
+ tty_ldiscs[disc].flags &= ~LDISC_FLAG_DEFINED;
}
spin_unlock_irqrestore(&tty_ldisc_lock, flags);
next prev parent reply other threads:[~2005-06-01 3:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-31 19:56 Alexey Dobriyan
2005-05-31 22:28 ` Paul Fulghum
2005-06-01 3:38 ` Paul Fulghum [this message]
2005-06-01 13:51 ` Paul Fulghum
2005-06-01 4:39 ` Greg KH
2005-06-01 5:42 ` Christoph Hellwig
2005-06-01 15:22 ` Alexey Dobriyan
2005-06-15 21:40 Alexey Dobriyan
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=1117597088.5888.18.camel@at2.pipehead.org \
--to=paulkf@microgate.com \
--cc=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--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
Powered by JetHome