Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp223600imu; Tue, 27 Nov 2018 11:23:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/UH4wBsb3ec7t9Qf9pHeYiMfbUe17q3g7ffeHiqmwD4SdMofSH0MZo4F2BEsywqQpKJbwd8 X-Received: by 2002:a17:902:1126:: with SMTP id d35mr28645675pla.1.1543346625007; Tue, 27 Nov 2018 11:23:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543346624; cv=none; d=google.com; s=arc-20160816; b=civBQ3RIVqO8mj2hIIgT+dMFdjLTB17UaxTQlpb0MEnwQSq5QDrXTwQguVeev+TRHR Xt9bgGFR1EtG8ttPBosA0lVellWluUdsKAZjv7AA6YWevPpRxybWU/r1K0GSEXnS2t8r 5eo42ZD6GX+rc4Pawwig32xsySn7+7Dm6lCnxWGeJ66db56XaqSWHJzsdB35l+EqfB/L ujCXPCz7i7FFUu2Ge+3vzNbcKUB898O+wyCLite7H7OeavP7f97mUqjy0irFGlB5cRTn oziNAW3FO3L6GzijT42NvSKCk5K+H0XnuChnHbQQFkauHVDPvJnDNofWmA9kr0Eln63p Ruzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cncK2TuCHeK5Z2eHVRvzB+HIE6CFxiJB6gmrocE80y0=; b=JAX+1gol1KqVYUkx7xXRfwwtlRNR+MVq5vScdrT9/sZw7zYYh4SWDWIjHvXpMb2gPm 7MXiSvVBUIWBkkFtAkgkZ3k024Eom2heSttSZJeoTGWXjsK4InIXYxLEeLQc0OIMeD5J llZ8L9zEQOIzm+6s68/C/Y2XcmG87ajXVF9Gi/SwoL7ACuGNKZlGiX9cZ58HjGC6PMJl K1JAVF8fbqNwQeB3O5iEssZ6DPuXzqIRXN1CWxvwv1tP26UeboTls3lF88pmWo7l5dlo e1GRk/xb8cELwBwW0DrL7zbRzu5W4voOCftGfCHhblRU4zGKggoY9Qlkk2THlE55oiKx ebFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf14-v6si4673640plb.422.2018.11.27.11.23.30; Tue, 27 Nov 2018 11:23:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728537AbeK1Bwd (ORCPT + 99 others); Tue, 27 Nov 2018 20:52:33 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:48648 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeK1Bwc (ORCPT ); Tue, 27 Nov 2018 20:52:32 -0500 X-Greylist: delayed 564 seconds by postgrey-1.27 at vger.kernel.org; Tue, 27 Nov 2018 20:52:32 EST Received: by unicorn.mansr.com (Postfix, from userid 51770) id DBB20149B5; Tue, 27 Nov 2018 14:44:58 +0000 (GMT) From: Mans Rullgard To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] mm: fix insert_pfn() return value Date: Tue, 27 Nov 2018 14:43:51 +0000 Message-Id: <20181127144351.9137-1-mans@mansr.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 9b5a8e00d479 ("mm: convert insert_pfn() to vm_fault_t") accidentally made insert_pfn() always return an error. Fix this. Fixes: 9b5a8e00d479 ("mm: convert insert_pfn() to vm_fault_t") Signed-off-by: Mans Rullgard --- mm/memory.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 4ad2d293ddc2..15baf50e3908 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1524,12 +1524,14 @@ static vm_fault_t insert_pfn(struct vm_area_struct *vma, unsigned long addr, pfn_t pfn, pgprot_t prot, bool mkwrite) { struct mm_struct *mm = vma->vm_mm; + int retval; pte_t *pte, entry; spinlock_t *ptl; pte = get_locked_pte(mm, addr, &ptl); if (!pte) return VM_FAULT_OOM; + retval = VM_FAULT_NOPAGE; if (!pte_none(*pte)) { if (mkwrite) { /* @@ -1567,9 +1569,10 @@ static vm_fault_t insert_pfn(struct vm_area_struct *vma, unsigned long addr, set_pte_at(mm, addr, pte, entry); update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */ + retval = 0; out_unlock: pte_unmap_unlock(pte, ptl); - return VM_FAULT_NOPAGE; + return retval; } /** -- 2.19.2