]> git.karo-electronics.de Git - karo-tx-linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jul 2013 01:21:34 +0000 (18:21 -0700)
commit4aa6022129a8b5e0b0e42815521071ce7a766a84
tree19eb1705accf3dd1c59966efd7a0761270f330c8
parentb7dc4032cd44843ea93119adb00a5f15b7b05943
ARM: 7768/1: prevent risks of out-of-bound access in ASID allocator

commit b8e4a4740fa2b17c0a447b3ab783b3dc10702e27 upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/mm/context.c