diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-02-25 11:10:42 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-02-25 11:10:42 -0500 |
commit | b255188f90e2bade1bd11a986dd1ca4861869f4d (patch) | |
tree | 39df34896ae3bdac7ae41cb17078a1caaa5bf1ad /arch/arm/mm | |
parent | 5e4ba617c1b584b2e376f31a63bd4e734109318a (diff) |
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 e97e806e 2c000000 11000000
3d80: ea86bb00 0000002c 00000011 e97e807e c076d2a8 e97e805e e97e806e 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>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/alignment.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index b820edaf3184..db26e2e543f4 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c | |||
@@ -749,7 +749,6 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
749 | unsigned long instr = 0, instrptr; | 749 | unsigned long instr = 0, instrptr; |
750 | int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); | 750 | int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); |
751 | unsigned int type; | 751 | unsigned int type; |
752 | mm_segment_t fs; | ||
753 | unsigned int fault; | 752 | unsigned int fault; |
754 | u16 tinstr = 0; | 753 | u16 tinstr = 0; |
755 | int isize = 4; | 754 | int isize = 4; |
@@ -760,16 +759,15 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
760 | 759 | ||
761 | instrptr = instruction_pointer(regs); | 760 | instrptr = instruction_pointer(regs); |
762 | 761 | ||
763 | fs = get_fs(); | ||
764 | set_fs(KERNEL_DS); | ||
765 | if (thumb_mode(regs)) { | 762 | 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); | ||
767 | if (!fault) { | 765 | if (!fault) { |
768 | if (cpu_architecture() >= CPU_ARCH_ARMv7 && | 766 | if (cpu_architecture() >= CPU_ARCH_ARMv7 && |
769 | IS_T32(tinstr)) { | 767 | IS_T32(tinstr)) { |
770 | /* Thumb-2 32-bit */ | 768 | /* Thumb-2 32-bit */ |
771 | u16 tinst2 = 0; | 769 | u16 tinst2 = 0; |
772 | fault = __get_user(tinst2, (u16 *)(instrptr+2)); | 770 | fault = probe_kernel_address(ptr + 1, tinst2); |
773 | instr = (tinstr << 16) | tinst2; | 771 | instr = (tinstr << 16) | tinst2; |
774 | thumb2_32b = 1; | 772 | thumb2_32b = 1; |
775 | } else { | 773 | } else { |
@@ -778,8 +776,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
778 | } | 776 | } |
779 | } | 777 | } |
780 | } else | 778 | } else |
781 | fault = __get_user(instr, (u32 *)instrptr); | 779 | fault = probe_kernel_address(instrptr, instr); |
782 | set_fs(fs); | ||
783 | 780 | ||
784 | if (fault) { | 781 | if (fault) { |
785 | type = TYPE_FAULT; | 782 | type = TYPE_FAULT; |