]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 7768/1: prevent risks of out-of-bound access in ASID allocator
authorMarc Zyngier <Marc.Zyngier@arm.com>
Fri, 21 Jun 2013 11:06:55 +0000 (12:06 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 24 Jun 2013 14:26:41 +0000 (15:26 +0100)
commit62d729a0aab000bbf5757b132cdd92e783a0b4dd
treed6315409786d92102af8e057c8c4183d2d002101
parent2ab01c2f69f4a61af2de795eae8364ece24a7262
ARM: 7768/1: prevent risks of out-of-bound access in ASID allocator

On a CPU that never ran anything, both the active and reserved ASID
fields are set to zero. In this case the ASID_TO_IDX() macro will
return -1, which is not a very useful value to index a bitmap.

Instead of trying to offset the ASID so that ASID #1 is actually
bit 0 in the asid_map bitmap, just always ignore bit 0 and start
the search from bit 1. This makes the code a bit more readable,
and without risk of OoB access.

Cc: <stable@vger.kernel.org> # 3.9
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/context.c