From: Ethan Tidmore <ethantidmore06@gmail.com>
To: Mina Almasry <almasrymina@google.com>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH] hugetlb: Fix possible deadlock
Date: Tue, 24 Mar 2026 19:46:53 -0500 [thread overview]
Message-ID: <20260325004653.150734-1-ethantidmore06@gmail.com> (raw)
In allocate_file_region_entries() error path the function region_chg()
returns but does not release the lock 'resv->lock'.
Release lock 'resv->lock' before returning.
Fixes: 0db9d74ed8845 ("hugetlb: disable region_add file_region coalescing")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
mm/hugetlb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d6ea11113f1d..230fd8c63588 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -807,8 +807,10 @@ static long region_chg(struct resv_map *resv, long f, long t,
if (*out_regions_needed == 0)
*out_regions_needed = 1;
- if (allocate_file_region_entries(resv, *out_regions_needed))
+ if (allocate_file_region_entries(resv, *out_regions_needed)) {
+ spin_unlock(&resv->lock);
return -ENOMEM;
+ }
resv->adds_in_progress += *out_regions_needed;
--
2.53.0
next reply other threads:[~2026-03-25 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 0:46 Ethan Tidmore [this message]
2026-03-25 2:01 ` [PATCH] hugetlb: Fix possible deadlock Andrew Morton
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=20260325004653.150734-1-ethantidmore06@gmail.com \
--to=ethantidmore06@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=rientjes@google.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