summaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2018-01-11 04:36:37 -0500
committerJuergen Gross <jgross@suse.com>2018-02-06 03:55:37 -0500
commit3ac7292a25db1c607a50752055a18aba32ac2176 (patch)
treefc61e3f29d937cff55bb19eb953cb64f8190e018 /drivers/xen
parent4f277295e54c5b7340e48efea3fc5cc21a2872b7 (diff)
xen/grant-table: Use put_page instead of free_page
The page given to gnttab_end_foreign_access() to free could be a compound page so use put_page() instead of free_page() since it can handle both compound and single pages correctly. This bug was discovered when migrating a Xen VM with several VIFs and CONFIG_DEBUG_VM enabled. It hits a BUG usually after fewer than 10 iterations. All netfront devices disconnect from the backend during a suspend/resume and this will call gnttab_end_foreign_access() if a netfront queue has an outstanding skb. The mismatch between calling get_page() and free_page() on a compound page causes a reference counting error which is detected when DEBUG_VM is enabled. Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/grant-table.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index f45114fd8e1e..27be107d6480 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -382,7 +382,7 @@ static void gnttab_handle_deferred(struct timer_list *unused)
382 if (entry->page) { 382 if (entry->page) {
383 pr_debug("freeing g.e. %#x (pfn %#lx)\n", 383 pr_debug("freeing g.e. %#x (pfn %#lx)\n",
384 entry->ref, page_to_pfn(entry->page)); 384 entry->ref, page_to_pfn(entry->page));
385 __free_page(entry->page); 385 put_page(entry->page);
386 } else 386 } else
387 pr_info("freeing g.e. %#x\n", entry->ref); 387 pr_info("freeing g.e. %#x\n", entry->ref);
388 kfree(entry); 388 kfree(entry);
@@ -438,7 +438,7 @@ void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
438 if (gnttab_end_foreign_access_ref(ref, readonly)) { 438 if (gnttab_end_foreign_access_ref(ref, readonly)) {
439 put_free_entry(ref); 439 put_free_entry(ref);
440 if (page != 0) 440 if (page != 0)
441 free_page(page); 441 put_page(virt_to_page(page));
442 } else 442 } else
443 gnttab_add_deferred(ref, readonly, 443 gnttab_add_deferred(ref, readonly,
444 page ? virt_to_page(page) : NULL); 444 page ? virt_to_page(page) : NULL);