[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190605161600.GA4720@zhanggen-UX430UQ>
Date: Thu, 6 Jun 2019 00:16:00 +0800
From: Gen Zhang <blackgod016574@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Ben Hutchings <ben@...adent.org.uk>, Jiri Slaby <jslaby@...e.com>,
Kees Cook <keescook@...omium.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Revert "consolemap: Fix a memory leaking bug in
drivers/tty/vt/consolemap.c"
On Tue, Jun 04, 2019 at 09:02:34PM +0200, Greg Kroah-Hartman wrote:
> 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@...adent.org.uk>
>
> Now applied, thanks.
>
> Gen, please be careful with these types of "fixes"...
Thanks for your comments. I will for sure. And I am always submutting
patches and revising it according to the maintainers.
Thanks
Gen
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists