powerpc: Fix __get_user_pages_fast() irq handling

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:02 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=95f715b08fa4a953771398d20cbe35a6803ea41d
Commit:     95f715b08fa4a953771398d20cbe35a6803ea41d
Parent:     0b5381a61821d1c074c76e01b27bf5f69cf2dd01
Author:     Heiko Carstens <heiko.carstens at de.ibm.com>
AuthorDate: Thu Nov 14 15:01:43 2013 +1100
Committer:  Benjamin Herrenschmidt <benh at kernel.crashing.org>
CommitDate: Thu Nov 21 10:33:37 2013 +1100

    powerpc: Fix __get_user_pages_fast() irq handling
    
    __get_user_pages_fast() may be called with interrupts disabled (see e.g.
    get_futex_key() in kernel/futex.c) and therefore should use local_irq_save()
    and local_irq_restore() instead of local_irq_disable()/enable().
    
    Signed-off-by: Heiko Carstens <heiko.carstens at de.ibm.com>
    CC: <stable at vger.kernel.org> [v3.12]
    Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 arch/powerpc/mm/gup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index 6936547..c5f734e 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -123,6 +123,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	struct mm_struct *mm = current->mm;
 	unsigned long addr, len, end;
 	unsigned long next;
+	unsigned long flags;
 	pgd_t *pgdp;
 	int nr = 0;
 
@@ -156,7 +157,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	 * So long as we atomically load page table pointers versus teardown,
 	 * we can follow the address down to the the page and take a ref on it.
 	 */
-	local_irq_disable();
+	local_irq_save(flags);
 
 	pgdp = pgd_offset(mm, addr);
 	do {
@@ -179,7 +180,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
 			break;
 	} while (pgdp++, addr = next, addr != end);
 
-	local_irq_enable();
+	local_irq_restore(flags);
 
 	return nr;
 }



More information about the linux-mtd-cvs mailing list