Skip to content

Commit

Permalink
[ARM] 4839/1: fixes kernel Oops in /dev/mem device driver for memory …
Browse files Browse the repository at this point in the history
…map with PHYS_OFF

"cat /dev/mem" may cause kernel Oops for boards with PHYS_OFFSET != 0
because character device is mapped to addresses starting from zero
and there is no protection against such situation.
Patch just add this.

Signed-off-by: Alexandre Rusev <arusev@ru.mvista.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Alexandre Rusev authored and Russell King committed Feb 29, 2008
1 parent c710e39 commit 9ae3ae0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
*/
int valid_phys_addr_range(unsigned long addr, size_t size)
{
if (addr < PHYS_OFFSET)
return 0;
if (addr + size > __pa(high_memory))
return 0;

Expand Down

0 comments on commit 9ae3ae0

Please sign in to comment.