LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Gen Zhang <blackgod016574@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c
Date: Wed, 22 May 2019 13:54:47 -0700	[thread overview]
Message-ID: <201905221353.AD8E585E6D@keescook> (raw)
In-Reply-To: <20190522015055.GC4093@zhanggen-UX430UQ>

On Wed, May 22, 2019 at 09:50:55AM +0800, Gen Zhang wrote:
> On Tue, May 21, 2019 at 01:44:33PM -0700, Kees Cook wrote:
> > This doesn't look safe to me: p->uni_pgdir[n] will still have a handle
> > to the freed memory, won't it?
> > 
> Thanks for your reply, Kees!
> I think you are right. Maybe we should do this:
> 	kfree(p1);
> 	p->uni_pgdir[n] = NULL;
> Is this correct?

That's what I'm not sure about. I *think* so, from reading the code, but
I'd love to have Greg (or someone more familiar with the code) to
double-check this.

Otherwise, yeah, this looks right. Please send a v2 and we can debate
the correctness there, if it turns out to be wrong. :)

-- 
Kees Cook

  reply	other threads:[~2019-05-22 20:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  9:29 Gen Zhang
2019-05-21 20:44 ` Kees Cook
2019-05-22  1:50   ` Gen Zhang
2019-05-22 20:54     ` Kees Cook [this message]
2019-05-23  0:29       ` Gen Zhang
2019-05-23  0:34       ` [PATCH v2] " Gen Zhang
2019-05-23 16:54         ` Kees Cook
2019-05-24  2:14           ` Gen Zhang
2019-05-24  2:19           ` [PATCH v2] consolemap: Fix a memory leaking bug in con_insert_unipair() Gen Zhang
2019-05-24  8:02             ` Greg KH
2019-05-24  9:37           ` [PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c Jon Hunter
2019-05-25  6:04             ` Kees Cook

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=201905221353.AD8E585E6D@keescook \
    --to=keescook@chromium.org \
    --cc=blackgod016574@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c' \
    /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

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).