From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 391281DFFD for ; Sat, 25 Apr 2026 13:54:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777125253; cv=none; b=s0hEcXUnlpKo6auhHDLHAmlZ19EgiBIDS5v3lQEfezQhPvxyY578LpNAPrOvynJ0PTQvQVUR8/+r6OfLPEx64BgF43j+ZrJMa/hysitDjUeUp5M7nzlbzqcfcJbkvIhXDF9cFlw0JH8zH3P/ekGA/Mf8K43XySj3tXZ9fmwdspo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777125253; c=relaxed/simple; bh=rUdHut0GlCu/YVEzg8W+5uhsWoukZ83p9VDTAwAPfH0=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=TNkyowNSMeKRwhi5FIzBXIwg+rTqL49m0qATlgsdwtZOag2HG1su6rrAIaNbXl3zastPcZRyFrRAh398MUfSh1qsUBcgtuDUnleNXvigKZusc/+jiX+rWKfH41MJ9ZLtqWwZXeqb7tozBTkKFLnjRnwKPwV0dCWcviD4c0UFj/I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=0kL6sRJC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="0kL6sRJC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E419C2BCB0; Sat, 25 Apr 2026 13:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777125252; bh=rUdHut0GlCu/YVEzg8W+5uhsWoukZ83p9VDTAwAPfH0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0kL6sRJCj3dAOI67ke33l8+BZ9BD7BTS/8bUUX4bSYv2qyP59nR86sGY0UJYFpdI8 CKtIoCkkz/XQIszfcPPWpdeMxrWNl04RsoVZgYpU1gwoQiUUVVynMJK2i8QMptOC9o UYS2TIxYAv9LpY0RdoXAn49G6V+SSxrwVa41bXhE= Date: Sat, 25 Apr 2026 06:54:11 -0700 From: Andrew Morton To: Sunny Patel Cc: David Hildenbrand , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Balbir Singh Subject: Re: [PATCH] mm/migrate_device: fix spinlock leak in migrate_vma_insert_huge_pmd_page Message-Id: <20260425065411.39842a941750fadab250cd79@linux-foundation.org> In-Reply-To: <20260425133537.17463-1-nueralspacetech@gmail.com> References: <20260425133537.17463-1-nueralspacetech@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 25 Apr 2026 19:05:27 +0530 Sunny Patel wrote: > When check_stable_address_space() fails after the PMD spinlock has > been acquired via pmd_lock(), the code jumps directly to the abort > label, bypassing the spin_unlock() call in unlock_abort. This causes > the PMD spinlock to be permanently held, leading to a deadlock. > > Change the goto target from abort to unlock_abort to ensure the > spinlock is always released on this error path. > > ... > > --- a/mm/migrate_device.c > +++ b/mm/migrate_device.c > @@ -850,7 +850,7 @@ static int migrate_vma_insert_huge_pmd_page(struct migrate_vma *migrate, > ptl = pmd_lock(vma->vm_mm, pmdp); > csa_ret = check_stable_address_space(vma->vm_mm); > if (csa_ret) > - goto abort; > + goto unlock_abort; > > /* > * Check for userfaultfd but do not deliver the fault. Instead, whoops. Fixes: a30b48bf1b24 ("mm/migrate_device: implement THP migration of zone device pages") Cc: