From: Johan Hovold <johan@kernel.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: gregkh@linuxfoundation.org, jslaby@suse.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty_port: Restore tty port default ops on unregistering
Date: Tue, 4 Feb 2020 10:47:48 +0100 [thread overview]
Message-ID: <20200204094748.GG26725@localhost> (raw)
In-Reply-To: <1580285224-7712-1-git-send-email-loic.poulain@linaro.org>
On Wed, Jan 29, 2020 at 09:07:04AM +0100, Loic Poulain wrote:
> When a port is unregistered from serdev, its serdev specific client_ops
> pointer is nullified, which can lead to future null pointer dereference.
> Fix that by restoring default client_ops when port is unregistered from
> serdev.
Hmm, yeah, this seems like something we should fix as 8250 appears to
allow reregistering ports, but...
> port registering/unregistering can happen several times, at least it
> happens when statically registered 8250 ISA port are replaced at boot
> time by e.g. device-tree defined 8250 ports.
How did the serdev controller get registered in the first place here if
you're talking about statically registered 8250 ISA ports (i.e. where is
the client defined)?
Did you actually ever hit this one?
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
> drivers/tty/tty_port.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
> index 044c3cb..bf893da 100644
> --- a/drivers/tty/tty_port.c
> +++ b/drivers/tty/tty_port.c
> @@ -203,8 +203,10 @@ void tty_port_unregister_device(struct tty_port *port,
> int ret;
>
> ret = serdev_tty_port_unregister(port);
> - if (ret == 0)
> + if (ret == 0) {
> + port->client_ops = &default_client_ops;
> return;
> + }
>
> tty_unregister_device(driver, index);
> }
Johan
next prev parent reply other threads:[~2020-02-04 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 8:07 [PATCH] tty_port: Restore tty port default ops on unregistering Loic Poulain
2020-02-04 9:47 ` Johan Hovold [this message]
[not found] ` <CAMZdPi8R_bj4+HFjCmiRTJ2KgToMMuX0fbopGBOsMPMhJ4xsXQ@mail.gmail.com>
2020-02-10 14:54 ` Johan Hovold
2020-02-10 14:57 ` [PATCH] serdev: ttyport: restore client ops on deregistration Johan Hovold
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=20200204094748.GG26725@localhost \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.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