]> err.no Git - linux-2.6/commitdiff
[ARM] 4839/1: fixes kernel Oops in /dev/mem device driver for memory map with PHYS_OFF
authorAlexandre Rusev <arusev@ru.mvista.com>
Tue, 26 Feb 2008 17:42:10 +0000 (18:42 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 29 Feb 2008 22:47:20 +0000 (22:47 +0000)
"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>
arch/arm/mm/mmap.c

index 2728b0e7d2bbd9a165e3f031454b9b5f1f7fc8aa..3f6dc40b835321fd469a23ce8ffa49089377e74b 100644 (file)
@@ -120,6 +120,8 @@ full_search:
  */
 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;