From: Greg KH <gregkh@linuxfoundation.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: jslaby@suse.com,
syzbot <syzbot+3aa9784721dfb90e984d@syzkaller.appspotmail.com>,
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v2] n_tty: Protect tty->disc_data using refcount.
Date: Wed, 25 Jul 2018 10:06:30 +0200 [thread overview]
Message-ID: <20180725080630.GA17932@kroah.com> (raw)
In-Reply-To: <8e83cd9a-e28c-a9f4-5f47-98f2046a5dfb@I-love.SAKURA.ne.jp>
On Wed, Jul 25, 2018 at 12:22:16AM +0900, Tetsuo Handa wrote:
> >From 118c64e86641a97d44dec39e313a95b12d9bc3b2 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Wed, 25 Jul 2018 00:15:18 +0900
> Subject: [PATCH v2] n_tty: Protect tty->disc_data using refcount.
>
> syzbot is reporting NULL pointer dereference at n_tty_set_termios() [1].
> This is because ioctl(TIOCVHANGUP) versus ioctl(TCSETS) can race.
>
> Since we don't want to introduce new locking dependency, this patch
> converts "struct n_tty_data *ldata = tty->disc_data;" in individual
> function into a function argument which follows "struct tty *", and
> holds tty->disc_data at each "struct tty_ldisc_ops" hook using refcount
> in order to ensure that memory which contains "struct n_tty_data" will
> not be released while processing individual function.
>
> [1] https://syzkaller.appspot.com/bug?id=1e850009fca0b64ce49dc16499bda4f7de0ab1a5
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> drivers/tty/n_tty.c | 511 ++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 314 insertions(+), 197 deletions(-)
What changed from v1? I haven't had the chance to review your first
patch, sorry, it's still in my queue. I was hoping that someone else
would help out with that as well :)
thanks,
greg k-h
next prev parent reply other threads:[~2018-07-25 8:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-01 17:01 KASAN: user-memory-access Write in n_tty_set_termios syzbot
2018-04-05 10:31 ` Tetsuo Handa
2018-04-06 10:06 ` Tetsuo Handa
2018-07-17 10:14 ` [PATCH] n_tty: Protect tty->disc_data using refcount Tetsuo Handa
2018-07-17 10:14 ` Tetsuo Handa
2018-07-24 15:22 ` [PATCH v2] " Tetsuo Handa
2018-07-24 15:22 ` Tetsuo Handa
2018-07-25 8:06 ` Greg KH [this message]
2018-07-25 12:35 ` Tetsuo Handa
2018-08-29 13:53 ` Jiri Slaby
2018-08-29 13:53 ` Jiri Slaby
2018-08-29 14:48 ` Jiri Slaby
2018-08-29 15:02 ` Tetsuo Handa
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=20180725080630.GA17932@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=syzbot+3aa9784721dfb90e984d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
/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.