Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1391729

[PATCH RESEND 3/5] Drivers: hv: balloon: don't crash when memory is added in non-sorted order

From "K. Y. Srinivasan" <kys@microsoft.com>
Newsgroups linux.kernel
Subject [PATCH RESEND 3/5] Drivers: hv: balloon: don't crash when memory is added in non-sorted order
Date 2016-05-01 02:50 +0200
Message-ID <rtNKa-k6-11@gated-at.bofh.it> (permalink)
References <rtNK9-k6-1@gated-at.bofh.it> <rtNK9-k6-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Vitaly Kuznetsov <vkuznets@redhat.com>

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>
---
 drivers/hv/hv_balloon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index b853b4b..43af913 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -714,7 +714,7 @@ static bool pfn_covered(unsigned long start_pfn, unsigned long pfn_cnt)
 		 * If the pfn range we are dealing with is not in the current
 		 * "hot add block", move on.
 		 */
-		if ((start_pfn >= has->end_pfn))
+		if (start_pfn < has->start_pfn || start_pfn >= has->end_pfn)
 			continue;
 		/*
 		 * If the current hot add-request extends beyond
@@ -768,7 +768,7 @@ static unsigned long handle_pg_range(unsigned long pg_start,
 		 * If the pfn range we are dealing with is not in the current
 		 * "hot add block", move on.
 		 */
-		if ((start_pfn >= has->end_pfn))
+		if (start_pfn < has->start_pfn || start_pfn >= has->end_pfn)
 			continue;
 
 		old_covered_state = has->covered_end_pfn;
-- 
1.7.4.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RESEND 0/5] Drivers: hv: Some miscellaneous fixes  "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200
  [PATCH RESEND 2/5] Drivers: hv: vmbus: handle various crash scenarios "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200
  [PATCH RESEND 5/5] tools: hv: lsvmbus: add pci pass-through UUID "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200
  [PATCH RESEND 3/5] Drivers: hv: balloon: don't crash when memory is added in non-sorted order "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200
  [PATCH RESEND 4/5] Drivers: hv: balloon: reset host_specified_ha_region "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200
  [PATCH RESEND 1/5] Drivers: hv: kvp: fix IP Failover "K. Y. Srinivasan" <kys@microsoft.com> - 2016-05-01 02:50 +0200

csiph-web