Commit 19da83f6 authored by George G. Davis's avatar George G. Davis Committed by Russell King

[ARM] 2959/1: Add test for invalid LDRD/STRD Rd cases in ARM alignment handler

Patch from George G. Davis

Add test for invalid LDRD/STRD Rd cases in ARM alignment handler
and restore SWP printk KERN_ERR.
Signed-off-by: default avatarSteve Longerbeam <slongerbeam@mvista.com>
Signed-off-by: default avatarGeorge G. Davis <gdavis@mvista.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 79d13b62
...@@ -330,6 +330,9 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, ...@@ -330,6 +330,9 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr,
{ {
unsigned int rd = RD_BITS(instr); unsigned int rd = RD_BITS(instr);
if (((rd & 1) == 1) || (rd == 14))
goto bad;
ai_dword += 1; ai_dword += 1;
if (user_mode(regs)) if (user_mode(regs))
...@@ -361,7 +364,8 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, ...@@ -361,7 +364,8 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr,
} }
return TYPE_LDST; return TYPE_LDST;
bad:
return TYPE_ERROR;
fault: fault:
return TYPE_FAULT; return TYPE_FAULT;
} }
...@@ -663,6 +667,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -663,6 +667,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
else if ((instr & 0x001000f0) == 0x000000d0 || /* LDRD */ else if ((instr & 0x001000f0) == 0x000000d0 || /* LDRD */
(instr & 0x001000f0) == 0x000000f0) /* STRD */ (instr & 0x001000f0) == 0x000000f0) /* STRD */
handler = do_alignment_ldrdstrd; handler = do_alignment_ldrdstrd;
else if ((instr & 0x01f00ff0) == 0x01000090) /* SWP */
goto swp;
else else
goto bad; goto bad;
break; break;
...@@ -733,6 +739,9 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -733,6 +739,9 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
do_bad_area(current, current->mm, addr, fsr, regs); do_bad_area(current, current->mm, addr, fsr, regs);
return 0; return 0;
swp:
printk(KERN_ERR "Alignment trap: not handling swp instruction\n");
bad: bad:
/* /*
* Oops, we didn't handle the instruction. * Oops, we didn't handle the instruction.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment