lkml.org 
[lkml]   [2005]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 1/2] Introduce tty_unregister_ldisc()
From
Date
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);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-01 05:41    [W:0.071 / U:1.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site