lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] mm/hmm/test: use after free in dmirror_allocate_chunk()
From
Date

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@oracle.com>

Looks good.
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>

\
 
 \ /
  Last update: 2020-09-24 21:26    [W:0.116 / U:1.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site