Re: [PATCH v2] mm/hmm/test: use after free in dmirror_allocate_chunk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx>

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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux