From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>, Jiri Slaby <jslaby@suse.cz>,
Xinyu Chen <xinyu.chen@freescale.com>,
Dirk Behme <dirk.behme@de.bosch.com>,
Shawn Guo <shawn.guo@linaro.org>,
Tim Sander <tim@krieglstein.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
stable@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: imx: Fix recursive locking bug
Date: Fri, 15 Feb 2013 09:30:16 -0800 [thread overview]
Message-ID: <20130215173016.GA27514@kroah.com> (raw)
In-Reply-To: <alpine.LFD.2.02.1302142006050.22263@ionos>
On Thu, Feb 14, 2013 at 09:01:06PM +0100, Thomas Gleixner wrote:
> commit 9ec1882df2 (tty: serial: imx: console write routing is unsafe
> on SMP) introduced a recursive locking bug in imx_console_write().
>
> The callchain is:
>
> imx_rxint()
> spin_lock_irqsave(&sport->port.lock,flags);
> ...
> uart_handle_sysrq_char();
> sysrq_function();
> printk();
> imx_console_write();
> spin_lock_irqsave(&sport->port.lock,flags); <--- DEAD
>
> The bad news is that the kernel debugging facilities can dectect the
> problem, but the printks never surface on the serial console for
> obvious reasons.
>
> There is a similar issue with oops_in_progress. If the kernel crashes
> we really don't want to be stuck on the lock and unable to tell what
> happened.
>
> In general most UP originated drivers miss these checks and nobody
> ever notices because CONFIG_PROVE_LOCKING seems to be still ignored by
> a large number of developers.
>
> The solution is to avoid locking in the sysrq case and trylock in the
> oops_in_progress case.
>
> This scheme is used in other drivers as well and it would be nice if
> we could move this to a common place, so the usual copy/paste/modify
> bugs can be avoided.
I agree, making this easier to handle would be nice, patches are always
accepted :)
thanks,
greg k-h
prev parent reply other threads:[~2013-02-15 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 20:01 [PATCH] serial: imx: Fix recursive locking bug Thomas Gleixner
2013-02-15 17:30 ` Greg Kroah-Hartman [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=20130215173016.GA27514@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dirk.behme@de.bosch.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawn.guo@linaro.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tim@krieglstein.org \
--cc=xinyu.chen@freescale.com \
/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;
as well as URLs for NNTP newsgroup(s).