From: Peter Hurley <peter@hurleysoftware.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-serial@vger.kernel.org, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@linux-m68k.org>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port()
Date: Tue, 11 Mar 2014 01:06:52 +0000 [thread overview]
Message-ID: <531E61AC.6040706@hurleysoftware.com> (raw)
In-Reply-To: <1393593694-30262-1-git-send-email-geert@linux-m68k.org>
[ +cc Alan ]
On 02/28/2014 08:21 AM, Geert Uytterhoeven wrote:
> From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
>
> If the serial port being removed is used as a console, it must also be
> unregistered from the console subsystem using unregister_console().
>
> uart_ops.release_port() will release resources (e.g. iounmap() the serial
> port registers), causing a crash on subsequent kernel output if the console
> is still registered.
This brings up an interesting point: where are the serial_core drivers
indicating to the tty core that the port is bound to a console?
IOW, I cannot find a single 'port->console = 1' anywhere in the serial tree.
It would be bad if the uart port disappears while a console is running
on it...
> Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
> ---
> drivers/tty/serial/serial_core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index ece2049bd270..8ece7f14d89d 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -2677,6 +2677,12 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
> tty_vhangup(port->tty);
>
> /*
> + * If the port is used as a console, unregister it
> + */
> + if (uart_console(uport))
> + unregister_console(uport->cons);
> +
> + /*
> * Free the port IO and memory resources, if any.
> */
> if (uport->type != PORT_UNKNOWN)
>
WARNING: multiple messages have this Message-ID (diff)
From: Peter Hurley <peter@hurleysoftware.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-serial@vger.kernel.org, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@linux-m68k.org>,
One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port()
Date: Mon, 10 Mar 2014 21:06:52 -0400 [thread overview]
Message-ID: <531E61AC.6040706@hurleysoftware.com> (raw)
In-Reply-To: <1393593694-30262-1-git-send-email-geert@linux-m68k.org>
[ +cc Alan ]
On 02/28/2014 08:21 AM, Geert Uytterhoeven wrote:
> From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
>
> If the serial port being removed is used as a console, it must also be
> unregistered from the console subsystem using unregister_console().
>
> uart_ops.release_port() will release resources (e.g. iounmap() the serial
> port registers), causing a crash on subsequent kernel output if the console
> is still registered.
This brings up an interesting point: where are the serial_core drivers
indicating to the tty core that the port is bound to a console?
IOW, I cannot find a single 'port->console = 1' anywhere in the serial tree.
It would be bad if the uart port disappears while a console is running
on it...
> Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
> ---
> drivers/tty/serial/serial_core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index ece2049bd270..8ece7f14d89d 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -2677,6 +2677,12 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
> tty_vhangup(port->tty);
>
> /*
> + * If the port is used as a console, unregister it
> + */
> + if (uart_console(uport))
> + unregister_console(uport->cons);
> +
> + /*
> * Free the port IO and memory resources, if any.
> */
> if (uport->type != PORT_UNKNOWN)
>
next prev parent reply other threads:[~2014-03-11 1:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 13:21 [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port() Geert Uytterhoeven
2014-02-28 13:21 ` Geert Uytterhoeven
2014-02-28 13:21 ` [PATCH 2/2] serial: sh-sci: Add missing call to uart_remove_one_port() in failure path Geert Uytterhoeven
2014-02-28 13:21 ` Geert Uytterhoeven
2014-03-06 4:19 ` Simon Horman
2014-03-06 4:19 ` Simon Horman
2014-03-06 4:34 ` Greg Kroah-Hartman
2014-03-06 4:34 ` Greg Kroah-Hartman
2014-03-11 1:06 ` Peter Hurley [this message]
2014-03-11 1:06 ` [PATCH 1/2] serial_core: Unregister console in uart_remove_one_port() Peter Hurley
2014-03-11 3:43 ` Peter Hurley
2014-03-11 3:43 ` Peter Hurley
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=531E61AC.6040706@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=geert+renesas@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@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.