Skip to content

Commit

Permalink
powerpc: Fix __get_user_pages_fast() irq handling
Browse files Browse the repository at this point in the history
__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 <[email protected]>
CC: <[email protected]> [v3.12]
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
heicarst authored and ozbenh committed Nov 20, 2013
1 parent 0b5381a commit 95f715b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/powerpc/mm/gup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand All @@ -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;
}
Expand Down

0 comments on commit 95f715b

Please sign in to comment.