From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Alan Cox <alan@redhat.com>,
Dmitry Torokhov <dtor@mail.ru>
Subject: Re: inconsistent lock state (tty? input?)
Date: Mon, 13 Oct 2008 21:31:19 +0200 [thread overview]
Message-ID: <20081013193114.GA5647@joi> (raw)
In-Reply-To: <20081013145712.5aa06871@infradead.org>
On Mon, Oct 13, 2008 at 02:57:12PM -0400, Arjan van de Ven wrote:
> On Mon, 13 Oct 2008 20:37:43 +0200
> Marcin Slusarz <marcin.slusarz@gmail.com> wrote:
>
> > On current git (a447c0932445f92ce6f4c1bd020f62c5097a7842):
> \
>
> good spotting;
>
> the patch below should fix this:
>
> From 26c117549415c55585f46ad38cd58a5f84f5adc7 Mon Sep 17 00:00:00 2001
> From: Arjan van de Ven <arjan@linux.intel.com>
> Date: Mon, 13 Oct 2008 14:56:39 -0400
> Subject: [PATCH] tty: make sure that proc_clear_tty stores the cpu flags
>
> proc_clear_tty() gets called with interrupts off (while holding the task list lock)
> from sys_setid. This means that it needs the _irqsave version of the locking primitives.
>
> Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
> ---
> drivers/char/tty_io.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index e4dce87..4715961 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -3595,9 +3595,10 @@ EXPORT_SYMBOL(tty_devnum);
>
> void proc_clear_tty(struct task_struct *p)
> {
> - spin_lock_irq(&p->sighand->siglock);
> + unsigned long flags;
> + spin_lock_irqsave(&p->sighand->siglock, flags);
> p->signal->tty = NULL;
> - spin_unlock_irq(&p->sighand->siglock);
> + spin_unlock_irqrestore(&p->sighand->siglock, flags);
> }
>
> /* Called under the sighand lock */
> --
It worked, thanks!
But I had to manually apply this patch (this function looks different now)
Updated patch below:
---
From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [PATCH] tty: make sure that proc_clear_tty stores the cpu flags
proc_clear_tty() gets called with interrupts off (while holding the task list lock)
from sys_setid. This means that it needs the _irqsave version of the locking primitives.
Reported-and-tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
drivers/char/tty_io.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7053d63..3f48d88 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3032,11 +3032,12 @@ EXPORT_SYMBOL(tty_devnum);
void proc_clear_tty(struct task_struct *p)
{
+ unsigned long flags;
struct tty_struct *tty;
- spin_lock_irq(&p->sighand->siglock);
+ spin_lock_irqsave(&p->sighand->siglock, flags);
tty = p->signal->tty;
p->signal->tty = NULL;
- spin_unlock_irq(&p->sighand->siglock);
+ spin_unlock_irqrestore(&p->sighand->siglock, flags);
tty_kref_put(tty);
}
--
1.5.6.4
prev parent reply other threads:[~2008-10-13 19:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-13 18:37 inconsistent lock state (tty? input?) Marcin Slusarz
2008-10-13 18:57 ` Arjan van de Ven
2008-10-13 19:31 ` Marcin Slusarz [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=20081013193114.GA5647@joi \
--to=marcin.slusarz@gmail.com \
--cc=alan@redhat.com \
--cc=arjan@infradead.org \
--cc=dtor@mail.ru \
--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