]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Drivers: hv: balloon: don't crash when memory is added in non-sorted order
authorVitaly Kuznetsov <vkuznets@redhat.com>
Sun, 1 May 2016 02:21:35 +0000 (19:21 -0700)
committerJiri Slaby <jslaby@suse.cz>
Fri, 7 Apr 2017 07:17:46 +0000 (09:17 +0200)
commit799207c78b0100788df0c76783c8de4b832773fd
tree4890c0bbcab070236fffce0b0b2cbc369af7d52a
parent4bdc5ba8a48cd171368def87ec1e701bdd8c5a9c
Drivers: hv: balloon: don't crash when memory is added in non-sorted order

commit 77c0c9735bc0ba5898e637a3a20d6bcb50e3f67d upstream.

When we iterate through all HA regions in handle_pg_range() we have an
assumption that all these regions are sorted in the list and the
'start_pfn >= has->end_pfn' check is enough to find the proper region.
Unfortunately it's not the case with WS2016 where host can hot-add regions
in a different order. We end up modifying the wrong HA region and crashing
later on pages online. Modify the check to make sure we found the region
we were searching for while iterating. Fix the same check in pfn_covered()
as well.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/hv/hv_balloon.c