mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
[ARM] 4839/1: fixes kernel Oops in /dev/mem device driver for memory 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>
This commit is contained in:
parent
c710e39cbe
commit
9ae3ae0beb
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
int valid_phys_addr_range(unsigned long addr, size_t size)
|
||||||
{
|
{
|
||||||
|
if (addr < PHYS_OFFSET)
|
||||||
|
return 0;
|
||||||
if (addr + size > __pa(high_memory))
|
if (addr + size > __pa(high_memory))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue