Received: by 10.213.65.68 with SMTP id h4csp2114731imn; Sun, 8 Apr 2018 20:05:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jZEbqzdfeqNzVMW4A41QtGF2YJ6UhwgnumMzcCu9TNKNHnHqm3wavqIUMQGNFvYdGHym5 X-Received: by 10.101.97.163 with SMTP id i3mr24310497pgv.447.1523243105994; Sun, 08 Apr 2018 20:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243105; cv=none; d=google.com; s=arc-20160816; b=tzX5l8SbD0rrP88DUDZ5t4/z0fBdmQ14zLdP9ivEaKg1yEOW0esksWxBizpHUpUTiA RI2hUZ5wiLPt8Y+PftctIgS99+KmatAuJfGMyWvRofq3KkQaEQkZXQhTVl9/MLe7Ni/j 8RfYMaIFZ8ysVOFfdeRx2Cd1XtZlBo8wsmcnbM1HlbuT9xihT+xc058fabxeLYdVkUPg ivAROfGXi6Av+w0b4WfVQMaP7UZhp4ojCREZsxlaWPAaIsWrrAEPTIVqa07drMOEa+fs vF9ivUQmet3hMWvRl9UTItLVP3Q3/hSV3wisa56OXY0mG9TnfGbPL4MAAe0guw7mBf2d W8OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=eodKxzhQHP0yL8UNPsgczb+UI8j2GaOld+8Ia4PHKEQ=; b=x6tuLCdN2/q4Lvbbi0rXL1Y5nL7KOZwiuGk/qosjvUFEmfOCqwnUFa76hkmOASm/Py kE4r3tGRSzRNFpUzfYxP8ZR98h7Y+YSo5jZg7dKl6xbmxhQfjYggBOKwDnsFtlwgSkh/ RWiMweo9iS9/lI26QQDYpNupGFpVKvgerNf6Dyy0TW30LqfyBoK9OhdgEh1r02prFPPE 1MoTTMTznhBfs9NZ1MmMEvGRMWkgoNcfuXtZEtCmKN361Z8bEvL6Tgip9rmkgFZFdn6e vVoVFo3IMs9YWzDSMdDgtEXGp5ovF5FjqDT4BdNrbNwGtYa96Lvp8LyaKG/HvtfgfsY3 Uwpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lQoWsZXN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si11897170pfw.173.2018.04.08.20.04.29; Sun, 08 Apr 2018 20:05:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=lQoWsZXN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933106AbeDIAjZ (ORCPT + 99 others); Sun, 8 Apr 2018 20:39:25 -0400 Received: from mail-co1nam03on0120.outbound.protection.outlook.com ([104.47.40.120]:40064 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933056AbeDIAix (ORCPT ); Sun, 8 Apr 2018 20:38:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=eodKxzhQHP0yL8UNPsgczb+UI8j2GaOld+8Ia4PHKEQ=; b=lQoWsZXNj/lRMOy1oFoIUj7wfeZyeXwsXRubeuRoGJEzXGenTiJijkQpqiCFKXcBtr7XqawTAVDkBN8cL0DJ4Kh6NjZMEZTS9R2B/sQkhKc9sFfuAg/xGW9yP4U9czyzfyLiaO3dx7IOp0azjQv2Ap7fUQ+gMnWOfBhsJeiVn6o= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1125.namprd21.prod.outlook.com (52.132.130.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:38:47 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:38:47 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Ross Lagerwall , Juergen Gross , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 150/162] xen/grant-table: Use put_page instead of free_page Thread-Topic: [PATCH AUTOSEL for 4.4 150/162] xen/grant-table: Use put_page instead of free_page Thread-Index: AQHTz5nc6UonNFYcZUCJq7k+/UfB9A== Date: Mon, 9 Apr 2018 00:29:47 +0000 Message-ID: <20180409002738.163941-150-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1125;7:V1fZiwUD4SiprcluA3muXdl6ol2i2R8TtSEK7fpNHKF3PDloyCSk45CLFdsQnG/qsMqM+DmT3mJf7kWajiRcOfE3QJNCnMoCEUUAYESoXBZK6wve+GqOYjeQ8G1KyZNHZtSRvVmRJFL31MsKJHfppRwqeXOwVixkmHG3fS9ICeqpYwfYcvUwl0UU1eYLioSQ8vnaoY+SlaxHc23n1njO5wqYG1+3D4qh9QFgCdu5QMqjHETRvWGnxRKvnvlEmlUw;20:vp5kC7Pjw0E1tzy3L/O1rMccaCcJCa89XDQPh6+x1IkxDX5D0e3jIDqwHzEbOFx6ATgncQXQbnj4BDCSp/6QHdtWyXwr6Bpx61USbljeJHSWGJyuAPFhHpZVeuZvweIgkZLUe+F0AAg6dux1ddIGbD+BYkb2CEum65spOekkLbE= X-MS-Office365-Filtering-Correlation-Id: c120c768-3309-40ff-d063-08d59db241b1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1125; x-ms-traffictypediagnostic: DM5PR2101MB1125: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(70601490899591)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1125;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1125; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(39380400002)(366004)(376002)(396003)(189003)(199004)(2906002)(25786009)(6512007)(10090500001)(8666007)(3280700002)(10290500003)(3660700001)(316002)(110136005)(54906003)(11346002)(107886003)(2616005)(476003)(446003)(36756003)(99286004)(86612001)(53936002)(4326008)(486006)(6436002)(3846002)(81156014)(305945005)(5250100002)(1076002)(102836004)(14454004)(66066001)(7736002)(105586002)(81166006)(59450400001)(106356001)(8676002)(97736004)(6116002)(6506007)(6486002)(5660300001)(186003)(76176011)(22452003)(72206003)(478600001)(2501003)(2900100001)(26005)(86362001)(8936002)(68736007)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1125;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: yQ00DHDExdkeP3/00nR0BYI8K1i1dKTfctiyahXeCpdeuQ1NNe6FWJciwGjOKC5BDVWkZbq4Nd/D9GWfOosPgh7HAuoSG1FFxXMMpRgtjoKo1DglNnz2G70OcFygi0ArwWowyyDnV4Z9/AznUuGM5PX0M9P5KXHt+mkyN0TzLrz/OP6/wbk65/mgR/yhcGxtxTOZxinnWaIb5TVwQlzgynpkGAGEK7VBtH+M1rD6h3k4HiI0jm9lIcWO1yMPNq/XlGCepdWrjNZBV4Dx5zEhjbbpEfjyrl9s8cWNjPLM767Z9cYnvaR/OJvYHXrJv5/Z3kz7QMbfk5IWRrVF5QI3xbf4w3CxuN95nssTMGt6bfqmEtkhzwOOnpwIF1uLmLF1As/bbsYH0jeEbfLnW+g6TPTkGAWeSYtbXx9u6i7lEz4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c120c768-3309-40ff-d063-08d59db241b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:29:47.0214 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ross Lagerwall [ Upstream commit 3ac7292a25db1c607a50752055a18aba32ac2176 ] 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 Reviewed-by: Boris Ostrovsky Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- 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 c49f79ed58c5..4b7ce442d8e5 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -328,7 +328,7 @@ static void gnttab_handle_deferred(unsigned long 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); @@ -384,7 +384,7 @@ void gnttab_end_foreign_access(grant_ref_t ref, int rea= donly, if (gnttab_end_foreign_access_ref(ref, readonly)) { put_free_entry(ref); if (page !=3D 0) - free_page(page); + put_page(virt_to_page(page)); } else gnttab_add_deferred(ref, readonly, page ? virt_to_page(page) : NULL); --=20 2.15.1