linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mans Rullgard <mans@mansr.com>
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	[thread overview]
Message-ID: <20181127144351.9137-1-mans@mansr.com> (raw)

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 <mans@mansr.com>
---
 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

             reply	other threads:[~2018-11-27 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 14:43 Mans Rullgard [this message]
2018-11-27 15:08 ` Matthew Wilcox
2018-11-27 15:20   ` Måns Rullgård

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=20181127144351.9137-1-mans@mansr.com \
    --to=mans@mansr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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