Received: by 10.213.65.68 with SMTP id h4csp2114278imn; Sun, 8 Apr 2018 20:04:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx49hIiGffuBPHW9J2xAMq6RwFmezCDP7Oh33xD+/UXnqAym8Jfdv86f1BLQWxibXHgJU+w1K X-Received: by 10.99.51.142 with SMTP id z136mr23425057pgz.272.1523243069014; Sun, 08 Apr 2018 20:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243068; cv=none; d=google.com; s=arc-20160816; b=YW4YPOhaZ8LSZZ8dLZI+UW4DaaEIOMzu4Qq7KB/vnw4O+8+IstznWtUdgdtkyMegWU 0ozvX0oFM3mJM+9Xm2KLJRHzlF5CdFDoffMWvO7hFFnJ+p4Gd3PUiLnr0hTnz/YS/qUl 2f0fInjqrzxmLVZebiX8djNECpsFsYcvJQM0Lk2b32JfD/EWkyYeJl35XD/StVFA66Vl ngC2NZhYzbUiv1qeBRE+qOWFYWAfKY9AD/w/wf/7Nu1yM2l3jDIpsN1UMQ5mDarcnZSw gD+z2fk2x3g7SZfpGUpEpNRgbIQpVOqPkexu0RskJo8nOWRCHZYchc/ZjNzuicVC8Tah IHvw== 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=NM3W/WWjz5P7hV9gAh5asjDBWnRBIbDWoyHOeLeDy2k=; b=Kx2Q3XJzM4MehHFDQi0cPuoZRLLOtgVs3VOqSGqaZeBWsG4/Kuu2YRj6028kPstVXK MfM77+n+/sEjzDESUv8hfJjKeT45xIN32heyzJ1GrUH0aeHPHHdRyRsLIY2SG7JX8S68 Ga8HkyE+/0iQkpquFNBF+l3fOac5f2PIBuQh7mTzxip4dD2ux12eOZVFqoLh6eGFto2K LkqHRVFTkHi39gIiwolCfCby4pXBbSgvNkQD5S/gilL9mJPN1q0GAQQex55Z3grdhdNe pqHj3q2FFG2PHojuVO1cjIf7D+NdGCZoeYxok8hG6BIDe8s5tqhD2ldKilWTbDIfwTPG GN4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=oG+MWAM+; 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 q61-v6si13230124plb.729.2018.04.08.20.03.52; Sun, 08 Apr 2018 20:04:28 -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=oG+MWAM+; 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 S1755243AbeDIAZp (ORCPT + 98 others); Sun, 8 Apr 2018 20:25:45 -0400 Received: from mail-bn3nam01on0139.outbound.protection.outlook.com ([104.47.33.139]:14848 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755228AbeDIAZl (ORCPT ); Sun, 8 Apr 2018 20:25:41 -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=NM3W/WWjz5P7hV9gAh5asjDBWnRBIbDWoyHOeLeDy2k=; b=oG+MWAM+ndmdB3ZADQ179UcBQ8yPnbpgHOTrb5ZP90Y8AhDpadvpxM9WN9EnD0wGkBjLgHMkTsEKwSVL1V5cnlmrv07cpaB2gwB/im1i/gZr0RHXKhy5vWGQSMQFGsLmPdCZWQqFyR1Dxa3CUe2EuoogoztE1vOJmpqB5g9MAx4= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) 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:25:36 +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:25:36 +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.14 129/161] xen/grant-table: Use put_page instead of free_page Thread-Topic: [PATCH AUTOSEL for 4.14 129/161] xen/grant-table: Use put_page instead of free_page Thread-Index: AQHTz5i6DD0SKK4BMECQqVckO1MRAA== Date: Mon, 9 Apr 2018 00:21:39 +0000 Message-ID: <20180409001936.162706-129-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-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;DM5PR2101MB1013;7:De7aNn9GgLFxyPJDMh8oCM/1jeOdGQ598tB7v1jLvNLBExSlMRfxSkI/4NMqoxbl4SqXDnXLuK3o7Z82DS3qIfqA6P1em+drB65Ab2S2pLfL0FfIAjoTdZ7eSTBMtNeeaC7+9ZlbEtl4LsmlHLGOR61MdLc37SCMaXNuTL6vgJ3CaCN1iMId0E1XoEpCmfBvQdYrM2y+JoXRgBSVbOwZvQpk4a9h7RbZkiv1r6T8JoGJG4cA8L6nA+vIOt8Rn8jK;20:dAQDY+i7JoB3AF51d2ZDFOIyxJpv62g6YcZiCh6Cfo2S+EoJg5cnP0yZ2y7MGKuEShb2e1sAB5gFun8NiiLiZ9xx35bH/km8V3Sf3SnY+VIw5k6IbQSBwLz+v2VZ1JjdzlAOwU6dpK8F+I4lnLsKUNaA0qmfBvrfpBjrnb8NYwk= X-MS-Office365-Filtering-Correlation-Id: 53b63b9a-7010-4416-6fd6-08d59db06a3b 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:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: 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:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(376002)(396003)(39860400002)(39380400002)(189003)(199004)(3280700002)(2616005)(8666007)(8936002)(7736002)(476003)(446003)(11346002)(53936002)(3660700001)(86362001)(86612001)(81156014)(2906002)(186003)(81166006)(105586002)(1076002)(8676002)(26005)(97736004)(25786009)(6512007)(3846002)(68736007)(72206003)(106356001)(5660300001)(6486002)(6116002)(14454004)(4326008)(305945005)(6436002)(2501003)(5250100002)(10290500003)(478600001)(2900100001)(59450400001)(22452003)(110136005)(316002)(99286004)(66066001)(10090500001)(107886003)(76176011)(102836004)(54906003)(6506007)(36756003)(486006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;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: pFbw4UbUx7LJFWRjsFKHAA82vfH5V/jXdXUcv32L6Ve6tGZxUey+cXd9cYqnzvjVvZN5ucDstA1V4oiCv5bnVBa/7rL1UgWRcX766F78AkZCuUkrgq/rXwHNS9Y7+rRcKLIglU5dfcG/oj6EyNolWBedrGbl1vYXp+Ofv0KnZ0JSPSmWqw0xJSa3Q4sZN45uj2F1Mm/ifV9HpsgFSvJc8c5lMQvfgg+EFiSpj98kIp3FoR0HxsAJfl8zYbJwiWcFOofmncAvqxMSIxI9eCgQuY0i30W+w4qJaKpVI0SchqNTpFSg8rb5Gt5yeTc+QOuU0V9nZHy9hXdw9G9yQL8glLmRozq8vJDnRWx8k6XQ1PIHFyQcPUF+SXoAroG/9IZw84cngimY5UjZNrsY9vOgEdluiqQyfjaRdzbO+IbGjGg= 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: 53b63b9a-7010-4416-6fd6-08d59db06a3b X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:39.2217 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 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 2c6a9114d332..1fb374466e84 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