Skip to content

Commit b255188

Browse files
author
Russell King
committed
ARM: fix scheduling while atomic warning in alignment handling code
Paolo Pisati reports that IPv6 triggers this warning: BUG: scheduling while atomic: swapper/0/0/0x40000100 Modules linked in: [<c001b1c4>] (unwind_backtrace+0x0/0xf0) from [<c0503c5c>] (__schedule_bug+0x48/0x5c) [<c0503c5c>] (__schedule_bug+0x48/0x5c) from [<c0508608>] (__schedule+0x700/0x740) [<c0508608>] (__schedule+0x700/0x740) from [<c007007c>] (__cond_resched+0x24/0x34) [<c007007c>] (__cond_resched+0x24/0x34) from [<c05086dc>] (_cond_resched+0x3c/0x44) [<c05086dc>] (_cond_resched+0x3c/0x44) from [<c0021f6c>] (do_alignment+0x178/0x78c) [<c0021f6c>] (do_alignment+0x178/0x78c) from [<c00083e0>] (do_DataAbort+0x34/0x98) [<c00083e0>] (do_DataAbort+0x34/0x98) from [<c0509a60>] (__dabt_svc+0x40/0x60) Exception stack(0xc0763d70 to 0xc0763db8) 3d60: e97e805e e97e806 2c000000 11000000 3d80: ea86bb00 0000002c 00000011 e97e807e c076d2a8 e97e805e e97e806 0000002c 3da0: 3d000000 c0763dbc c04b98fc c02a8490 00000113 ffffffff [<c0509a60>] (__dabt_svc+0x40/0x60) from [<c02a8490>] (__csum_ipv6_magic+0x8/0xc8) Fix this by using probe_kernel_address() stead of __get_user(). Cc: <stable@vger.kernel.org> Reported-by: Paolo Pisati <p.pisati@gmail.com> Tested-by: Paolo Pisati <p.pisati@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 5e4ba61 commit b255188

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎arch/arm/mm/alignment.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
749749
unsigned long instr = 0, instrptr;
750750
int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
751751
unsigned int type;
752-
mm_segment_t fs;
753752
unsigned int fault;
754753
u16 tinstr = 0;
755754
int isize = 4;
@@ -760,16 +759,15 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
760759

761760
instrptr = instruction_pointer(regs);
762761

763-
fs = get_fs();
764-
set_fs(KERNEL_DS);
765762
if (thumb_mode(regs)) {
766-
fault = __get_user(tinstr, (u16 *)(instrptr & ~1));
763+
u16 *ptr = (u16 *)(instrptr & ~1);
764+
fault = probe_kernel_address(ptr, tinstr);
767765
if (!fault) {
768766
if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
769767
IS_T32(tinstr)) {
770768
/* Thumb-2 32-bit */
771769
u16 tinst2 = 0;
772-
fault = __get_user(tinst2, (u16 *)(instrptr+2));
770+
fault = probe_kernel_address(ptr + 1, tinst2);
773771
instr = (tinstr << 16) | tinst2;
774772
thumb2_32b = 1;
775773
} else {
@@ -778,8 +776,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
778776
}
779777
}
780778
} else
781-
fault = __get_user(instr, (u32 *)instrptr);
782-
set_fs(fs);
779+
fault = probe_kernel_address(instrptr, instr);
783780

784781
if (fault) {
785782
type = TYPE_FAULT;

0 commit comments

Comments
 (0)