From: Sunny Patel <nueralspacetech@gmail.com>
To: ziy@nvidia.com
Cc: akpm@linux-foundation.org, apopple@nvidia.com, byungchul@sk.com,
david@kernel.org, gourry@gourry.net, joshua.hahnjy@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
matthew.brost@intel.com, nueralspacetech@gmail.com,
rakie.kim@sk.com, ying.huang@linux.alibaba.com
Subject: Re: [PATCH] mm/migrate_device: fix pgtable leak in migrate_vma_insert_huge_pmd_page
Date: Mon, 27 Apr 2026 12:15:17 +0530 [thread overview]
Message-ID: <20260427064517.19784-1-nueralspacetech@gmail.com> (raw)
In-Reply-To: <5D99B763-2544-4130-9117-9E6BEFE6A2CB@nvidia.com>
On Sat, 25 Apr 2026 10:21:01 -0400, Zi Yan wrote:
> I think the "goto abort" above pmd_lock() need to do pte_free():
>
> if (folio_is_device_private(folio)) {
> ...
> } else {
> if (folio_is_zone_device(folio) &&
> !folio_is_device_coherent(folio)) {
> goto abort; <-- this one
> }
> ...
> }
>
> The lock is not taken yet, so you might need to add a pte_free()
> before goto abort.
You are right. The pgtable is allocated before this check and
the lock has not been taken yet at this point, so goto
unlock_abort would be incorrect here. A pte_free() call is
needed before this goto abort.
Sent v2 with the changes.
https://lore.kernel.org/linux-mm/20260427063729.17294-1-nueralspacetech@gmail.com/
Thanks for catching this.
Regards,
Sunny Patel
next prev parent reply other threads:[~2026-04-27 6:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-25 13:44 [PATCH] mm/migrate_device: fix pgtable leak in migrate_vma_insert_huge_pmd_page Sunny Patel
2026-04-25 14:17 ` Zi Yan
2026-04-25 14:21 ` Zi Yan
2026-04-27 6:45 ` Sunny Patel [this message]
2026-04-27 1:42 ` Huang, Ying
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=20260427064517.19784-1-nueralspacetech@gmail.com \
--to=nueralspacetech@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=byungchul@sk.com \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.brost@intel.com \
--cc=rakie.kim@sk.com \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.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