From: Peter Hurley <peter@hurleysoftware.com>
To: Imre Deak <imre.deak@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] vt: fix check for system/busy console drivers when unregistering them
Date: Fri, 12 Dec 2014 12:30:38 -0500 [thread overview]
Message-ID: <548B263E.6050502@hurleysoftware.com> (raw)
In-Reply-To: <1418402285-9578-1-git-send-email-imre.deak@intel.com>
Hi Imre,
On 12/12/2014 11:38 AM, Imre Deak wrote:
> System console drivers (without the CON_DRIVER_FLAG_MODULE flag) and
> busy drivers bound to a console (as reported by con_is_bound())
> shouldn't be unregistered. The current code checks for the
> CON_DRIVER_FLAG_INIT flag but this doesn't really correspond to either
> of the above two conditions. CON_DRIVER_FLAG_INIT is set whenever its
> associated console's con_startup() function is called, which first
> happens when the console driver is registered (so before the console
> gets bound) and gets cleared when the console gets unbound. The
> purpose of this flag is to show if we need to call con_startup() on a
> console before we use it.
>
> Based on the above, do_unregister_con_driver() in its current form will
> incorrectly allow unregistering a console driver only if it was never
> bound, but will refuse to unregister one that was bound and later
> unbound. It will also allow unregistering a system console driver.
>
> Fix this by checking for CON_DRIVER_FLAG_MODULE to refuse unregistering
> a system console driver and relying on the existing con_is_bound() check
> earlier in the function to refuse unregistering a busy console driver.
Maybe reword these two paragraphs?
"Allow non-system console drivers to unregister, and prevent system
console drivers from unregistering."
Regards,
Peter Hurley
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/tty/vt/vt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index b33b00b..1862e89 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3660,7 +3660,7 @@ int do_unregister_con_driver(const struct consw *csw)
> struct con_driver *con_driver = ®istered_con_driver[i];
>
> if (con_driver->con == csw &&
> - con_driver->flag & CON_DRIVER_FLAG_INIT) {
> + con_driver->flag & CON_DRIVER_FLAG_MODULE) {
> vtconsole_deinit_device(con_driver);
> device_destroy(vtconsole_class,
> MKDEV(0, con_driver->node));
>
next prev parent reply other threads:[~2014-12-12 17:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-12 16:38 [PATCH 1/3] vt: fix check for system/busy console drivers when unregistering them Imre Deak
2014-12-12 16:38 ` [PATCH 2/3] vt: fix locking around vt_bind/vt_unbind Imre Deak
2014-12-12 17:53 ` Peter Hurley
2014-12-12 16:38 ` [PATCH 3/3] vt: fix console lock vs. kernfs s_active lock order Imre Deak
2014-12-12 18:32 ` Peter Hurley
2014-12-12 20:29 ` Imre Deak
2014-12-12 20:55 ` Imre Deak
2014-12-12 21:03 ` Peter Hurley
2014-12-12 22:03 ` Imre Deak
2014-12-12 22:45 ` Peter Hurley
2014-12-12 22:58 ` Imre Deak
2014-12-13 21:14 ` [PATCH v2 " Imre Deak
2014-12-13 23:07 ` [PATCH v3 " Imre Deak
2014-12-12 17:30 ` Peter Hurley [this message]
2014-12-13 21:14 ` [PATCH v2 1/3] vt: fix check for system/busy console drivers when unregistering them Imre Deak
2014-12-15 15:05 ` Daniel Vetter
2014-12-15 16:08 ` Imre Deak
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=548B263E.6050502@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=imre.deak@intel.com \
--cc=jslaby@suse.cz \
--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