From: Alan Cox <alan@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: lkml <linux-kernel@vger.kernel.org>,
"Greg Kroah-Hartman" <gregkh@suse.de>
Subject: Re: possible locking bug in tty_open
Date: Tue, 4 May 2010 20:42:36 +0100 [thread overview]
Message-ID: <20100504204236.5dc6a34e@linux.intel.com> (raw)
In-Reply-To: <201005022247.33857.arnd@arndb.de>
On Sun, 2 May 2010 22:47:33 +0200
Arnd Bergmann <arnd@arndb.de> wrote:
> While playing some more with my TTY BKL patches, I stumbled over
> what looks like a bug in tty_open, introduced in e8c6210
> "tty: push the BKL down into the handlers a bit":
>
> After the "retry_open:" label, we first get the tty_mutex
> and then the BKL. However a the end of tty_open, we jump
> back to retry_open with the BKL still held. If we run into
> this case, the tty_open function will be left with the BKL
> still held.
>
> It may be impossible to actually trigger this bug, because
> the path is only taken if a tty driver open function returns
> -ERESTARTSYS without setting signal_pending().
>
> Arnd
I think all we need is probably this
tty: Fix unbalanced BKL handling in error path
Arnd noted:
After the "retry_open:" label, we first get the tty_mutex
and then the BKL. However a the end of tty_open, we jump
back to retry_open with the BKL still held. If we run into
this case, the tty_open function will be left with the BKL
still held.
Signed-off-by: Alan Cox <alan@linux.intel.com>
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 6da962c..fe810a7 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1875,6 +1875,7 @@ got_driver:
*/
if (filp->f_op == &hung_up_tty_fops)
filp->f_op = &tty_fops;
+ unlock_kernel();
goto retry_open;
}
unlock_kernel();
next prev parent reply other threads:[~2010-05-04 20:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-02 20:47 possible locking bug in tty_open Arnd Bergmann
2010-05-04 9:43 ` Alan Cox
2010-05-04 19:42 ` Alan Cox [this message]
2010-05-04 20:26 ` Arnd Bergmann
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=20100504204236.5dc6a34e@linux.intel.com \
--to=alan@linux.intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@suse.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.