From patchwork Tue Jun 1 09:24:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12290851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29600C4708F for ; Tue, 1 Jun 2021 09:24:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF60261364 for ; Tue, 1 Jun 2021 09:24:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF60261364 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0D6C66B00A4; Tue, 1 Jun 2021 05:24:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05F366B00A6; Tue, 1 Jun 2021 05:24:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF3E56B00A7; Tue, 1 Jun 2021 05:24:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id AA6106B00A4 for ; Tue, 1 Jun 2021 05:24:25 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 32F1F180AD802 for ; Tue, 1 Jun 2021 09:24:25 +0000 (UTC) X-FDA: 78204619290.17.D095FD1 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf07.hostedemail.com (Postfix) with ESMTP id 1676CA00025C for ; Tue, 1 Jun 2021 09:24:11 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1519DlsP002560; Tue, 1 Jun 2021 09:24:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2020-01-29; bh=jN7+gUrA4PoLPxt0TxmBGmGW1ZJ+sWOMQa5ojP8FOLI=; b=YJz5eTlNAe93Y94xSW5Ggx6Hh3SGqyCLfHQwcmzOeGNRWCbz2RLtTCPV0snHxX3bM9yH MBp9U2cm7kNRD26BZQuU05C88ZXXU7KTQeC/inXuvT5CaLPP2BAzUR3EWChn+BLgGZr9 owz5zuNGtVCXRenFGuhFBPB2h5XurqhTTPuiHRHd8MXbK/U/4Z9iC/7eXqOngko6rHX0 QegeB8NGAVsbpnagN8fDUwdmdX5oqCtE7CZyRWzAzOo9XoKROjcGdbtoHpxBByvs5p1b cex1L8r4yWmaKpkh5xXRY6h+kzh3MWM+QQHC05i45nfUydj60AsASzaN/3iZhSEOQY/T /g== Received: from oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 38vpk2gg3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:24:22 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 1519HTHJ029745; Tue, 1 Jun 2021 09:24:21 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 38uaqw62nu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:24:21 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 1519OKuB041457; Tue, 1 Jun 2021 09:24:20 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 38uaqw62nr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 01 Jun 2021 09:24:20 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 1519OJRp012577; Tue, 1 Jun 2021 09:24:19 GMT Received: from mwanda (/41.212.42.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 01 Jun 2021 02:24:18 -0700 Date: Tue, 1 Jun 2021 12:24:09 +0300 From: Dan Carpenter To: Andrew Morton , Yang Shi Cc: Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm: thp: fix a double unlock bug Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-GUID: 5FwNM0G1IyYbJRtmC7W_AiVNZk2TJwOt X-Proofpoint-ORIG-GUID: 5FwNM0G1IyYbJRtmC7W_AiVNZk2TJwOt Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=YJz5eTlN; spf=none (imf07.hostedemail.com: domain of dan.carpenter@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=dan.carpenter@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1676CA00025C X-Stat-Signature: gi8q9dz5t96q31ahe56i1jtp85xtmd58 X-HE-Tag: 1622539451-864744 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We're supposed to be holding the "vmf->ptl" spin_lock when we goto out_map. The lock is dropped after if finishes cleaning up. Fixes: 9aff7b33c74a ("mm: thp: refactor NUMA fault handling") Signed-off-by: Dan Carpenter Acked-by: Mel Gorman --- mm/huge_memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index e353bbc6cee3..caa0148f15bb 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1465,10 +1465,8 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) pmd = pmd_modify(oldpmd, vma->vm_page_prot); page = vm_normal_page_pmd(vma, haddr, pmd); - if (!page) { - spin_unlock(vmf->ptl); + if (!page) goto out_map; - } /* See similar comment in do_numa_page for explanation */ if (!was_writable)