From: Ralph Campbell <rcampbell@nvidia.com>
To: "Dan Carpenter" <dan.carpenter@oracle.com>,
"Jérôme Glisse" <jglisse@redhat.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
Jason Gunthorpe <jgg@ziepe.ca>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] mm/hmm/test: use after free in dmirror_allocate_chunk()
Date: Thu, 24 Sep 2020 19:25:11 +0000 [thread overview]
Message-ID: <eb06e0c8-327e-6677-c393-139dffdf0dbe@nvidia.com> (raw)
In-Reply-To: <20200924134651.GA1586456@mwanda>
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>
next prev parent reply other threads:[~2020-09-24 19:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 8:12 [PATCH] mm/hmm/test: use after free in dmirror_allocate_chunk() Dan Carpenter
2020-09-22 17:31 ` Ralph Campbell
2020-09-24 13:46 ` [PATCH v2] " Dan Carpenter
2020-09-24 19:25 ` Ralph Campbell [this message]
2020-09-24 13:47 ` [PATCH] " Dan Carpenter
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=eb06e0c8-327e-6677-c393-139dffdf0dbe@nvidia.com \
--to=rcampbell@nvidia.com \
--cc=dan.carpenter@oracle.com \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=weiyongjun1@huawei.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).