Message ID | 20191007163550.20548-2-andrea.righi@canonical.com |
---|---|
State | New |
Headers | show |
Series | PM / hibernate: fix potential memory corruption | expand |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index f155c62..334191d 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -662,8 +662,14 @@ zone_found: * node for our pfn. */ + /* + * If the zone we wish to scan is the the current zone and the + * pfn falls into the current node then we do not need to walk + * the tree. + */ node = bm->cur.node; - if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) + if (zone == bm->cur.zone && + ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) goto node_found; node = zone->rtree;