From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>
Subject: Re: [PATCH 1/2] xen/grant-table: Use put_page instead of free_page
Date: Thu, 11 Jan 2018 15:48:36 +0000 [thread overview]
Message-ID: <0194fe18-b109-4160-544d-923a53e1ad82@citrix.com> (raw)
In-Reply-To: <20180111093638.28937-2-ross.lagerwall@citrix.com>
+CC netdev
On 01/11/2018 09:36 AM, Ross Lagerwall wrote:
> 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>
> ---
> drivers/xen/grant-table.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index f45114f..27be107 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)
> if (entry->page) {
> pr_debug("freeing g.e. %#x (pfn %#lx)\n",
> entry->ref, page_to_pfn(entry->page));
> - __free_page(entry->page);
> + put_page(entry->page);
> } else
> pr_info("freeing g.e. %#x\n", entry->ref);
> kfree(entry);
> @@ -438,7 +438,7 @@ void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
> if (gnttab_end_foreign_access_ref(ref, readonly)) {
> put_free_entry(ref);
> if (page != 0)
> - free_page(page);
> + put_page(virt_to_page(page));
> } else
> gnttab_add_deferred(ref, readonly,
> page ? virt_to_page(page) : NULL);
>
next prev parent reply other threads:[~2018-01-11 15:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 9:36 [PATCH 0/2] Fix a couple of crashes in netfront Ross Lagerwall
2018-01-11 9:36 ` [PATCH 1/2] xen/grant-table: Use put_page instead of free_page Ross Lagerwall
2018-01-11 15:48 ` Ross Lagerwall [this message]
2018-01-16 18:47 ` Boris Ostrovsky
2018-01-11 9:36 ` [PATCH 2/2] xen-netfront: Fix race between device setup and open Ross Lagerwall
2018-01-11 15:26 ` David Miller
2018-01-11 15:49 ` Ross Lagerwall
2018-01-11 16:08 ` David Miller
2018-01-11 16:27 ` Ross Lagerwall
2018-01-11 16:36 ` David Miller
2018-01-16 18:56 ` Boris Ostrovsky
2018-01-11 15:48 ` [PATCH 0/2] Fix a couple of crashes in netfront Ross Lagerwall
2018-02-06 14:52 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0194fe18-b109-4160-544d-923a53e1ad82@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox