From: Al Viro <viro@ZenIV.linux.org.uk>
To: Michael Neuling <mikey@neuling.org>
Cc: greg@kroah.com, johan Hovold <johan@kernel.org>,
Peter Hurley <peter@hurleysoftware.com>,
Alexander Popov <alex.popov@linux.com>,
Rob Herring <robh@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Dmitry Vyukov <dvyukov@google.com>,
benh <benh@kernel.crashing.org>,
LKML <linux-kernel@vger.kernel.org>,
Wang YanQing <udknight@gmail.com>, Jiri Slaby <jslaby@suse.com>
Subject: Re: [PATCH] tty: Fix crash with flush_to_ldisc()
Date: Fri, 7 Apr 2017 05:12:05 +0100 [thread overview]
Message-ID: <20170407041205.GY29622@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20170407035053.3068-1-mikey@neuling.org>
On Fri, Apr 07, 2017 at 01:50:53PM +1000, Michael Neuling wrote:
> diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> index bdf0e6e899..a2a9832a42 100644
> --- a/drivers/tty/n_tty.c
> +++ b/drivers/tty/n_tty.c
> @@ -1668,11 +1668,17 @@ static int
> n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
> char *fp, int count, int flow)
> {
> - struct n_tty_data *ldata = tty->disc_data;
> + struct n_tty_data *ldata;
> int room, n, rcvd = 0, overflow;
>
> down_read(&tty->termios_rwsem);
>
> + ldata = tty->disc_data;
> + if (!ldata) {
> + up_read(&tty->termios_rwsem);
I very much doubt that it's correct. It shouldn't have been called after
the n_tty_close(); apparently it has been. ->termios_rwsem won't serialize
against it, and something apparently has gone wrong with the exclusion there.
At the very least I would like to see what's to prevent n_tty_close() from
overlapping the exection of this function - if *that* is what broke, your
patch will only paper over the problem.
next prev parent reply other threads:[~2017-04-07 4:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 3:50 [PATCH] tty: Fix crash with flush_to_ldisc() Michael Neuling
2017-04-07 4:12 ` Al Viro [this message]
2017-04-07 4:58 ` Michael Neuling
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=20170407041205.GY29622@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=alex.popov@linux.com \
--cc=benh@kernel.crashing.org \
--cc=dvyukov@google.com \
--cc=greg@kroah.com \
--cc=johan@kernel.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikey@neuling.org \
--cc=mpatocka@redhat.com \
--cc=peter@hurleysoftware.com \
--cc=robh@kernel.org \
--cc=udknight@gmail.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).