[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eb06e0c8-327e-6677-c393-139dffdf0dbe@nvidia.com>
Date: Thu, 24 Sep 2020 12:25:11 -0700
From: Ralph Campbell <rcampbell@...dia.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Jérôme Glisse <jglisse@...hat.com>
CC: Wei Yongjun <weiyongjun1@...wei.com>,
Jason Gunthorpe <jgg@...pe.ca>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH v2] mm/hmm/test: use after free in
dmirror_allocate_chunk()
On 9/24/20 6:46 AM, Dan Carpenter wrote:
> The error handling code does this:
>
> err_free:
> kfree(devmem);
> ^^^^^^^^^^^^^
> err_release:
> release_mem_region(devmem->pagemap.range.start, range_len(&devmem->pagemap.range));
> ^^^^^^^^
> The problem is that when we use "devmem->pagemap.range.start" the
> "devmem" pointer is either NULL or freed.
>
> Neither the allocation nor the call to request_free_mem_region() has to
> be done under the lock so I moved those to the start of the function.
>
> Fixes: b2ef9f5a5cb3 ("mm/hmm/test: add selftest driver for HMM")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Looks good.
Reviewed-by: Ralph Campbell <rcampbell@...dia.com>
Powered by blists - more mailing lists