From patchwork Tue Nov 27 14:43:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TcOlbnMgUnVsbGfDpXJk?= X-Patchwork-Id: 10700651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CB5A13BB for ; Tue, 27 Nov 2018 14:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A2CD2B9CA for ; Tue, 27 Nov 2018 14:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4802E2B9E3; Tue, 27 Nov 2018 14:45:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 224FB2B9ED for ; Tue, 27 Nov 2018 14:45:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26CB36B487D; Tue, 27 Nov 2018 09:45:02 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1F1E36B487E; Tue, 27 Nov 2018 09:45:02 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 093536B487F; Tue, 27 Nov 2018 09:45:02 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id B71096B487D for ; Tue, 27 Nov 2018 09:45:01 -0500 (EST) Received: by mail-wr1-f71.google.com with SMTP id d11so18292773wrw.4 for ; Tue, 27 Nov 2018 06:45:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=cncK2TuCHeK5Z2eHVRvzB+HIE6CFxiJB6gmrocE80y0=; b=E45qTLy9otzVsFOVUpJfHW4OQIOwJL3jav2pL/Nf7lPBa/d4kN6Owp8glt1GSIX84Y CraC23NuAA+hRXo0oc8O2zyaSqJptpE7CfV3mlwCZ0/2hdlWp8FTP0VuaFOuKwT2/0Ap wWLyjDrYDPKBanToMxjWh5mcSGf2S9QrDZhu07lJfMej+aoAsHaUy2eWSex5yBc++P/o PvXK8OMQmKaJJRBnLtDRIEV0a/nnwQ1jToD/fyknKfDerEa4578zrXDMlaLXC3BG5DA/ pbjV/GC8tvH9aQ7HvETtBMlk08GteF1RhNJIf9fifHA30wouzcYyrpiPuBLMF/2v15+X vBPA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mru@mansr.com designates 81.2.72.234 as permitted sender) smtp.mailfrom=mru@mansr.com X-Gm-Message-State: AA+aEWbg7AlS1mjBmEuNirT9nX2OG8G2OMZAzn4wLyRdJfJhCgtB3wXF AXCkNvgGLJYlxkzUb3jSr51pukMCPH2Y2PZxe8T+Z6NZDd/sWDE2QOMnDbB09daMLCYgZzBKv+W ZzDa0iwEIxlFk4VZixKITNNpmvWuNMhaAhgYMV7huO401kREm02mcz4flhewmE6vrMw== X-Received: by 2002:a1c:ed12:: with SMTP id l18mr28405674wmh.55.1543329901205; Tue, 27 Nov 2018 06:45:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UEJ6mPdPoetGYJxtRzNT6v/HsaqpmZijIQQChsOVja+yGsd3TDMEvj/YHwUfoVGGnftwyj X-Received: by 2002:a1c:ed12:: with SMTP id l18mr28405618wmh.55.1543329900073; Tue, 27 Nov 2018 06:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543329900; cv=none; d=google.com; s=arc-20160816; b=n93vg+xZh5quYKdqLWrbsLzbvlnIRu8/8AhIA3lugUaV8SC/ny5QcPBd3AK4zb2BAc oSNlo2Opac9FnMLgCyKYBbIF6XzFxoyQMC1qIoMGnbrPeCsggxM1iTjFcymDD5rFOmst YtW5kjIO63sWRbV+sLNdz+nKWacFbqaf3rEmptozwoQH6LF3QbPqbyovt7J9Rnn50nsX ub7WbVGA7Z8K8qSb49GAoS3804zYanhBxsa1IUPx5pol/CH9AylbK2KItHL4EfJVTYni f9IqSubICZY+4DExyIN6GvYJEqyJ6wNAWxLHVhKVg1M0Gx9IhfI+aeLvD8jR1Rw/sYWI Na4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=cncK2TuCHeK5Z2eHVRvzB+HIE6CFxiJB6gmrocE80y0=; b=on/0RJ7aRQFKmXSVXbpV63Bwzupmo9o9ZQ+9xTxgyKQ6ivar5S29vhPgQGAwpi7J3D MzBoFv2Iv4s9+aWypZreI+jp+r7Vdu0pqEjNf1g1+SA8DvUqNVFDgFt/09zpJ0LQLUDl vaKWp+oZDSAGsmXz7HGSipbroRlQJ9X9od0nXY300L+ceJjIL1P3DtPp06Agp5PlR9Df RRMpAPnV+NmhdmcqqkqaWUdYdjHv9UUsFF/TmO1VYUd+Qwvnk5xS6tiK7URLosWnuTUq L3QwpSRYnNlBsvO00KsmQIuWIzQnQOCM4RpPyHkuL79LtJy8RwtTirpJqYMfd/shljId Zwuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mru@mansr.com designates 81.2.72.234 as permitted sender) smtp.mailfrom=mru@mansr.com Received: from unicorn.mansr.com (unicorn.mansr.com. [81.2.72.234]) by mx.google.com with ESMTPS id d9si3119593wrs.133.2018.11.27.06.44.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 06:44:59 -0800 (PST) Received-SPF: pass (google.com: domain of mru@mansr.com designates 81.2.72.234 as permitted sender) client-ip=81.2.72.234; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mru@mansr.com designates 81.2.72.234 as permitted sender) smtp.mailfrom=mru@mansr.com 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000304, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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; } /**