mm: fix unmap_atomic range checks
Subsystems (3)
PATCH 1/1 mm: fix unmap_atomic range checks
Commit 3e4d3af501cccdc8a8cca41bdbe57d54ad7e7e73 ("mm: stack based kmap_atomic()", in 2.6.37-rc1) had three places where range checking logic was reversed.
arch/tile/mm/highmem.c +2 -2
@@ -235,8 +235,8 @@ void __kunmap_atomic(void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {pte_t *pte =kmap_get_pte (vaddr);pte_t pteval = *pte;int idx, type;
arch/x86/mm/highmem_32.c +2 -2
@@ -70,8 +70,8 @@ void __kunmap_atomic(void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {int idx, type; type =kmap_atomic_idx ();
arch/x86/mm/iomap_32.c +2 -2
@@ -94,8 +94,8 @@ iounmap_atomic(void __iomem *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {int idx, type; type =kmap_atomic_idx ();
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Peter Zijlstra
maintainerQuoted 3 lines · Chuck Ebbert
Commit
3e4d3af501cccdc8a8cca41bdbe57d54ad7e7e73("mm: stack basedkmap_atomic()", in 2.6.37-rc1) had three places where range checking logic was reversed.
Where's the oopses to go along with this?
I think its actually correct, since on both x86 and tile we have:
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
Which flips the address space around, ie, END < BEGIN.
Quoted 31 lines
Signed-off-by Chuck Ebbert <[email protected]>arch/tile/mm/highmem.c +2
-2@@ -235,8 +235,8 @@ void __kunmap_atomic(void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {pte_t *pte =kmap_get_pte (vaddr);pte_t pteval = *pte;int idx, type;arch/x86/mm/highmem_32.c +2
-2@@ -70,8 +70,8 @@ void __kunmap_atomic(void *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {int idx, type; type =kmap_atomic_idx ();
arch/x86/mm/iomap_32.c iounmap_atomic(void __iomem *kvaddr) · line 101
Quoted 10 lines
arch/x86/mm/iomap_32.c +2
-2@@ -94,8 +94,8 @@ iounmap_atomic(void __iomem *kvaddr) {unsigned long vaddr = (unsigned long ) kvaddr &PAGE_MASK ; -if (vaddr >=__fix_to_virt (FIX_KMAP_END ) && - vaddr <=__fix_to_virt (FIX_KMAP_BEGIN )) { +if (vaddr >=__fix_to_virt (FIX_KMAP_BEGIN ) && + vaddr <=__fix_to_virt (FIX_KMAP_END )) {int idx, type; type =kmap_atomic_idx ();
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>