From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH] hvc: ensure hvc_init is only ever called once in hvc_console.c
Date: Tue, 14 Jan 2014 13:13:33 -0800 [thread overview]
Message-ID: <20140114211333.GB28453@kroah.com> (raw)
In-Reply-To: <1389733436-4661-1-git-send-email-paul.gortmaker@windriver.com>
On Tue, Jan 14, 2014 at 04:03:37PM -0500, Paul Gortmaker wrote:
> Commit 3e6c6f630a5282df8f3393a59f10eb9c56536d23 ("Delay creation of
> khcvd thread") moved the call of hvc_init from being a device_initcall
> into hvc_alloc, and used a non-null hvc_driver as indication of whether
> hvc_init had already been called.
>
> The problem with this is that hvc_driver is only assigned a value
> at the bottom of hvc_init, and so there is a window where multiple
> hvc_alloc calls can be in progress at the same time and hence try
> and call hvc_init multiple times. Previously the use of device_init
> guaranteed that hvc_init was only called once.
>
> This manifests itself as sporadic instances of two hvc_init calls
> racing each other, and with the loser of the race getting -EBUSY
> from tty_register_driver() and hence that virtual console fails:
>
> Couldn't register hvc console driver
> virtio-ports vport0p1: error -16 allocating hvc for port
>
> Here we add an atomic_t to guarantee we'll never run hvc_init twice.
>
> Cc: stable@vger.kernel.org # v2.6.24+
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 3e6c6f630a52 ("Delay creation of khcvd thread")
> Reported-by: Jim Somerville <Jim.Somerville@windriver.com>
> Tested-by: Jim Somerville <Jim.Somerville@windriver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>
> [Greg: I realize tty-next is closed; given that this is an ancient
> bug, I don't see any real urgency here, so feel free to queue it
> whenever/whereever is most convenient - assuming it is an OK fix.]
Looks ok, I'll queue it up after 3.14-rc1 is out, thanks.
greg k-h
prev parent reply other threads:[~2014-01-14 21:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 21:03 [PATCH] hvc: ensure hvc_init is only ever called once in hvc_console.c Paul Gortmaker
2014-01-14 21:13 ` 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=20140114211333.GB28453@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=rusty@rustcorp.com.au \
--cc=stable@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