arm/p2m: remove the page from p2m->pages list before freeing it
authorJulien Grall <julien.grall@arm.com>
Fri, 24 Feb 2017 08:58:50 +0000 (09:58 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 24 Feb 2017 08:58:50 +0000 (09:58 +0100)
commitcf5e1a74b9687be3d146e59ab10c26be6da9d0d4
tree409b568b41ccc97a7591641c892462bf681fc129
parent5258ab0fcc67587d802e33bcc5bf89048d184a73
arm/p2m: remove the page from p2m->pages list before freeing it

The p2m code is using the page list field to link all the pages used
for the stage-2 page tables. The page is added into the p2m->pages
list just after the allocation but never removed from the list.

The page list field is also used by the allocator, not removing may
result a later Xen crash due to inconsistency (see [1]).

This bug was introduced by the reworking of p2m code in commit 2ef3e36ec7
"xen/arm: p2m: Introduce p2m_set_entry and __p2m_set_entry".

[1] https://lists.xenproject.org/archives/html/xen-devel/2017-02/msg00524.html

Reported-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/p2m.c