From: Andrew Morton <akpm@zip.com.au>
To: Colin Phipps <cph@cph.demon.co.uk>
Cc: Robert Love <rml@tech9.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] updated preempt-kernel
Date: Sun, 21 Oct 2001 08:24:12 -0700 [thread overview]
Message-ID: <3BD2E89C.78D757A2@zip.com.au> (raw)
In-Reply-To: <1003562833.862.65.camel@phantasy>, <1003562833.862.65.camel@phantasy> <20011021120539.A1197@cph.demon.co.uk>
Colin Phipps wrote:
>
> [1.] NULL pointer deference in con_flush_chars with preempt patch
> [2.]
> Ok, running with preempt-kernel-rml-2.4.12-ac3-2.patch I had a crash
> yesterday. It occured when the machine was under
> light load, I had just exited X, and I was logging off a console - I may
> have hit ctrl-d twice. I did a little investigating myself, and the
> closest I could find in the archives was the problem mentioned in
> http://www.geocrawler.com/archives/3/35/1998/11/0/217652/ , except my
> crash is occuring at console close instead of open. It may not be
> preempt related, just preempt induced :-)
>
This one has been reported before.
n_tty_receive_buf() puts a character into the tty queue and
then calls con_flush_chars(), which touches tty->driver_data.
Problem is, there's a window between these two operations where the
device can be closed (especially if the char is "^D"!), and con_close()
will zero out tty->driver_data. Hence null pointer deref.
I don't really believe this explanation, because the timing's
wrong - the reader isn't woken until after the flush is called.
Hence it'll be very difficult to actually trigger this race.
It's probably something else. But a bit more sticking plaster
should make it appear to be fixed:
--- linux-2.4.12-ac3/drivers/char/console.c Mon Oct 15 16:04:23 2001
+++ ac/drivers/char/console.c Sun Oct 21 08:19:42 2001
@@ -2387,9 +2387,15 @@ static void con_flush_chars(struct tty_s
return;
pm_access(pm_con);
- acquire_console_sem();
- set_cursor(vt->vc_num);
- release_console_sem();
+ if (vt) {
+ /*
+ * If we raced with con_close(), `vt' may be null.
+ * Hence this bandaid. - akpm
+ */
+ acquire_console_sem();
+ set_cursor(vt->vc_num);
+ release_console_sem();
+ }
}
/*
next prev parent reply other threads:[~2001-10-21 15:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-20 7:27 [PATCH] updated preempt-kernel Robert Love
2001-10-20 12:44 ` elko
2001-10-22 20:43 ` elko
2001-10-22 23:11 ` Robert Love
2001-10-23 15:13 ` elko
2001-10-23 15:40 ` Andre's PDC20269 support patch? J.R. de Jong
2001-10-20 12:59 ` [PATCH] updated preempt-kernel Lorenzo Allegrucci
2001-10-20 17:02 ` Robert Love
2001-10-22 15:32 ` bill davidsen
2001-10-22 18:39 ` Mike Fedyk
2001-10-22 23:08 ` Robert Love
2001-10-21 11:05 ` Colin Phipps
2001-10-21 15:24 ` Andrew Morton [this message]
2001-10-21 18:16 ` Robert Love
2001-10-22 15:36 ` Taral
2001-10-21 18:23 ` Federico Sevilla III
2001-10-22 8:27 ` Jesper Juhl
2001-10-22 14:46 ` szonyi calin
2001-10-22 23:03 ` Robert Love
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=3BD2E89C.78D757A2@zip.com.au \
--to=akpm@zip.com.au \
--cc=cph@cph.demon.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
/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