public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Ethan Tidmore <ethantidmore06@gmail.com>
Cc: Mina Almasry <almasrymina@google.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	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
Subject: Re: [PATCH] hugetlb: Fix possible deadlock
Date: Tue, 24 Mar 2026 19:01:44 -0700	[thread overview]
Message-ID: <20260324190144.019600ff50d0734233e07bf9@linux-foundation.org> (raw)
In-Reply-To: <20260325004653.150734-1-ethantidmore06@gmail.com>

On Tue, 24 Mar 2026 19:46:53 -0500 Ethan Tidmore <ethantidmore06@gmail.com> wrote:

> 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.
> 
> ...
>
> --- 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;

Thanks, but please see how allocate_file_region_entries() leaves the
lock unheld if it's going to return -ENOMEM.



      reply	other threads:[~2026-03-25  2:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  0:46 [PATCH] hugetlb: Fix possible deadlock Ethan Tidmore
2026-03-25  2:01 ` Andrew Morton [this message]

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=20260324190144.019600ff50d0734233e07bf9@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=almasrymina@google.com \
    --cc=david@kernel.org \
    --cc=ethantidmore06@gmail.com \
    --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