LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Jiri Slaby <jslaby@suse.com>,
	Gen Zhang <blackgod016574@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Revert "consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c"
Date: Tue, 4 Jun 2019 21:02:34 +0200	[thread overview]
Message-ID: <20190604190234.GA10572@kroah.com> (raw)
In-Reply-To: <20190604180039.gai2phwdxn7ias6n@decadent.org.uk>

On Tue, Jun 04, 2019 at 07:00:39PM +0100, Ben Hutchings wrote:
> This reverts commit 84ecc2f6eb1cb12e6d44818f94fa49b50f06e6ac.
> 
> con_insert_unipair() is working with a sparse 3-dimensional array:
> 
> - p->uni_pgdir[] is the top layer
> - p1 points to a middle layer
> - p2 points to a bottom layer
> 
> If it needs to allocate a new middle layer, and then fails to allocate
> a new bottom layer, it would previously free only p2, and now it frees
> both p1 and p2.  But since the new middle layer was already registered
> in the top layer, it was not leaked.
> 
> However, if it looks up an *existing* middle layer and then fails to
> allocate a bottom layer, it now frees both p1 and p2 but does *not*
> free any other bottom layers under p1.  So it *introduces* a memory
> leak.
> 
> The error path also cleared the wrong index in p->uni_pgdir[],
> introducing a use-after-free.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Now applied, thanks.

Gen, please be careful with these types of "fixes"...

thanks,

greg k-h

  reply	other threads:[~2019-06-04 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 18:00 Ben Hutchings
2019-06-04 19:02 ` Greg Kroah-Hartman [this message]
2019-06-05 16:16   ` 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=20190604190234.GA10572@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ben@decadent.org.uk \
    --cc=blackgod016574@gmail.com \
    --cc=jslaby@suse.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] Revert "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).