From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: mhw@wittsend.com, LKML <linux-kernel@vger.kernel.org>,
Marcel Holtmann <marcel@holtmann.org>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] race condition with drivers/char/vt.c (bug in vt_ioctl.c)
Date: Mon, 22 Aug 2005 09:50:57 -0400 [thread overview]
Message-ID: <1124718657.5647.17.camel@localhost.localdomain> (raw)
In-Reply-To: <20050822071330.GA18456@elte.hu>
On Mon, 2005-08-22 at 09:13 +0200, Ingo Molnar wrote:
>
> cool fix. I'm wondering, there's a whole lot of other 'tty->count == 1'
> checks in drivers/char/*.c, could some of those be racy too?
I checked them out. The main problem is that tty->count == 1 is not
reliable in the open function call. Of the 22 files that use tty->count
== 1, only 4 of them (not including vt.c) have a potential race.
Three of the 4, have the race only if an error occurred.
synclink.c
synclink_cs.c
synclinkmp.c
The code in these three have something like this:
static int open(struct tty_struct *tty, struct file *filp)
{
...
if (/* some error */) {
retval = /* something bad */
goto cleanup;
}
...
cleanup:
if (retval) {
if (tty->count == 1)
info->tty = NULL; /* tty layer will release tty struct */
if(info->count)
info->count--;
}
return retval;
}
So, the info->tty has a chance of not being set to NULL. I don't know
how bad that is, but this is probably a bug.
The fourth file "ip2main.c" is a little more of a problem.
It's open has the following code:
noblock:
/* first open - Assign termios structure to port */
if ( tty->count == 1 ) {
i2QueueCommands(PTYPE_INLINE, pCh, 0, 2, CMD_CTSFL_DSAB, CMD_RTSFL_DSAB);
/* Now we must send the termios settings to the loadware */
set_params( pCh, NULL );
}
So, there's a chance that tty->count does not equal 1 here when it
should. The way to fix this would probably be to set driver_data to
NULL with some locking around it, and check that instead. Like what was
done for vt.c. Since I don't have an ip2 device that I know of, I won't
be fixing this code.
-- Steve
next prev parent reply other threads:[~2005-08-22 21:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-20 3:21 [PATCH] race condition with drivers/char/vt.c (bug in vt_ioctl.c) Steven Rostedt
2005-08-22 7:13 ` Ingo Molnar
2005-08-22 13:50 ` Steven Rostedt [this message]
2005-08-23 0:08 ` Antonino A. Daplas
2005-08-23 0:19 ` Steven Rostedt
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=1124718657.5647.17.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=mhw@wittsend.com \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.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