linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gen Zhang <blackgod016574@gmail.com>
To: Johan Hovold <johan@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty_io: Fix a missing-check bug in drivers/tty/tty_io.c
Date: Wed, 22 May 2019 19:24:49 +0800	[thread overview]
Message-ID: <20190522112449.GA6666@zhanggen-UX430UQ> (raw)
In-Reply-To: <20190522111949.GB568@localhost>

On Wed, May 22, 2019 at 01:19:49PM +0200, Johan Hovold wrote:
> On Wed, May 22, 2019 at 07:13:54PM +0800, Gen Zhang wrote:
> > On Wed, May 22, 2019 at 12:29:00PM +0200, Johan Hovold wrote:
> > > Where do you see that the kernel is dereferencing tty->dev without
> > > checking for NULL first? If you can find that, then that would indeed be
> > > a bug that needs fixing.
> > Thanks for your reply, Johan!
> > I examined the code but failed to find this situation.
> 
> Ok, so your claim in the commit message was incorrect:
> 
> 	And tty->dev is dereferenced in the following codes.
> 
> > Anyway, checking return value of tty_get_device() is theoritically
> > right. But tty->dev is never dereferenced, so checking is not needed.
> 
> No, sorry, it's not even theoretically correct. Our current code depends
> on tty->dev sometimes being NULL. Your patch would specifically break
> pseudo terminals.
Thanks for your comments. I have to be very proficient in this module
to know this. Of course I am not.
Anyway, appreciate your replies, Johan.
Thanks
Gen
> 
> > However, what if in later kernels tty->dev is dereferenced by some
> > codes? Is it better to apply this check for this reason?
> 
> So for the above reason, no.
> 
> Johan

  reply	other threads:[~2019-05-22 11:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  1:40 [PATCH] tty_io: Fix a missing-check bug in drivers/tty/tty_io.c Gen Zhang
2019-05-22  4:25 ` Jiri Slaby
2019-05-22  8:06   ` Gen Zhang
2019-05-22  8:15     ` Jiri Slaby
2019-05-22 10:29       ` Johan Hovold
2019-05-22 10:32         ` Jiri Slaby
2019-05-22 11:13         ` Gen Zhang
2019-05-22 11:19           ` Johan Hovold
2019-05-22 11:24             ` Gen Zhang [this message]
2019-05-22 11:18       ` Gen Zhang

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=20190522112449.GA6666@zhanggen-UX430UQ \
    --to=blackgod016574@gmail.com \
    --cc=johan@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).