mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul Fulghum" <paulkf@microgate.com>
To: "Andrew Morton" <andrewm@uow.edu.au>, "Kevin Buhr" <buhr@stat.wisc.edu>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: PATCH against 2.4.2: TTY hangup on PPP channel corrupts kernel memory
Date: Fri, 23 Mar 2001 09:54:49 -0600	[thread overview]
Message-ID: <003101c0b3b1$976fe550$013ca8c0@diemos> (raw)
In-Reply-To: <vbaofv1nyza.fsf@mozart.stat.wisc.edu>	<15027.20462.682109.679714@argo.linuxcare.com.au>	<vbasnkblsvd.fsf@mozart.stat.wisc.edu>	<15034.53871.560040.366149@argo.linuxcare.com.au>,	Paul Mackerras's message of "Fri, 23 Mar 2001 15:34:55 +1100 (EST)" <vbalmpxyo7n.fsf@mozart.stat.wisc.edu> <3ABB2B4B.93515581@uow.edu.au>

From: "Andrew Morton" <andrewm@uow.edu.au>

> Your analysis is correct.  It's a bug.
> 
> Furthermore, n_hdlc_tty_open() (for example) can sleep prior to
> incrementing the module refcount, which means the module can be
> unloaded while it's running.  I cut a patch ages ago which fixes
> this one for both ttys and ldiscs.  I never got around to sending
> it to anyone.
> 
> > Does this mean that all line discipline implementations must use a
> > spinlock around critical code in "open", "close", and every other line
> > discipline function?  It looks like they must, and it looks like most
> > don't right now.

I have experienced essentially the same problem:
A line discipline can be switched while a user mode program is blocked
inside of a line discipline call.

In my case the call was ioctl() (select) which went through the ldisc
(n_hdlc) and was being serviced by (and blocked in) the tty layer. 

Two processes had the underlying serial device open. One process
restored the ldisc to N_TTY, exited, and the script that started
the process unloaded the ldisc driver (which had
a zero ref count as a result of being switched out).
When the select call of the other process tried to return
(to the n_hdlc ldisc), the code was already unloaded and an
oops occurred.

I was not too worried about this because it was caused by
a series of wrong (buggy) moves by the user mode processes.

But it goes back to the problem of allowing the ldisc to
change when there are existing calls blocked in (or through)
the ldisc. 

Paul Fulghum paulkf@microgate.com
Microgate Corporation www.microgate.com



      reply	other threads:[~2001-03-23 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-16 22:14 Kevin Buhr
2001-03-17 11:52 ` Paul Mackerras
2001-03-18  2:21   ` Kevin Buhr
2001-03-23  4:34   ` Paul Mackerras
2001-03-23  6:49     ` Kevin Buhr
2001-03-23 10:54       ` Andrew Morton
2001-03-23 15:54         ` Paul Fulghum [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='003101c0b3b1$976fe550$013ca8c0@diemos' \
    --to=paulkf@microgate.com \
    --cc=andrewm@uow.edu.au \
    --cc=buhr@stat.wisc.edu \
    --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®