Received: by 10.213.65.68 with SMTP id h4csp2118823imn; Sun, 8 Apr 2018 20:10:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/b1XdVor2ZtY5RWIaRt0gFo3iNZU0UUdTfGu4WKRr6nydPgYDtMIcZvrU72rEaetppQkFP X-Received: by 10.98.137.218 with SMTP id n87mr27992593pfk.48.1523243322450; Sun, 08 Apr 2018 20:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243322; cv=none; d=google.com; s=arc-20160816; b=plNZ4V+2eeWZ+2ob0jklY5sx3v8wxB4vShK4/8EjrnEhqh+7e6ZfCAK2c5s3AwVF/j vS7MT9Fnkyai1Zg97Cxde+ODwOpqW3+H6oAITYU97A1n3aLaprVYwJS3YdQyTctuy9i+ k1zMyWzi2dHxiuDuxo95HzvSHUzbQ3EcA+Oz6BnT1lkqJTz2X6iTm5tTCU02OCQQPH1L aX4dQd8A9xS3nEmE6mQwDsaUL2xrfD3WPVPjMzZ6TgBo/TVxZ7nK5YcdM9uxYWASAc9z CkST+1SUfm1ekrZd74IL+MFPHgc0MnV07VIFEv+kUdEzz9PlH45z7SFqIrroQnmJKx4m OeoQ== 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=k7m8b19C0QxHzoetaytuXTgPHc0pKo1QKH8VATBsyZE=; b=hffsz16Pz5c3mcKKzBvUvBZqBm0w+GC97JwG53SJOi4hMo5i4O0NW4a+pAMZIvktnJ pvDzCZHazakKtHUr76lEyr+6SHnwcPkSQu+p3uC/PM8E+Hm6W916KeS6DtS8Tu/1mkpS azfg4X2PQ1XX9IICEwhWZitqQuV5JPiYak1qKBXq8KLccMLGFduZ5vHYIY1winm76M/u 06ZSWOSHOX9USD/eHnHbawDBUf2nwVOyYHMI2U1h1uUmP5wOKDlR7UsuSyQ7SCAHPP66 2y9teAxd8Pi50w0gH6lvAWCh7q5ixF3ygJEuQ8uwiRGAaG4F8kcAsv44sh9XfkegLA4/ yA9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=exL8QHRb; 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 94-v6si13736013ple.56.2018.04.08.20.08.04; Sun, 08 Apr 2018 20:08:42 -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=exL8QHRb; 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 S932622AbeDIBpC (ORCPT + 99 others); Sun, 8 Apr 2018 21:45:02 -0400 Received: from mail-bl2nam02on0134.outbound.protection.outlook.com ([104.47.38.134]:51004 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932494AbeDIAen (ORCPT ); Sun, 8 Apr 2018 20:34:43 -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=k7m8b19C0QxHzoetaytuXTgPHc0pKo1QKH8VATBsyZE=; b=exL8QHRb4/KtjLRmoR1lmSYGq85EFAKvkfZKa3ehKI3Q59yYZNB6NSrySexFpEElu0MdUb8Nik/iEhIRCjNli36VunzQNeVke+SaUUl4IJOfJDzs1zkgjVdzhVLR5R2gUAMwBmbRw8SHNGlFAXX8O60Ss26yrYfbctmINowh+Vg= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0984.namprd21.prod.outlook.com (52.132.133.30) 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:34:38 +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:34:38 +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.9 276/293] xen/grant-table: Use put_page instead of free_page Thread-Topic: [PATCH AUTOSEL for 4.9 276/293] xen/grant-table: Use put_page instead of free_page Thread-Index: AQHTz5lopQEofBPJi0WQFAgxU9u0Wg== Date: Mon, 9 Apr 2018 00:26:31 +0000 Message-ID: <20180409002239.163177-276-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0984;7:RsxtLSM5eTlMoNsyw1SnRzOHR2xeboIuQ2B7epIgCEUKfJ3cI8G9YmXjmm8V71iPLrXZAqmLAHy3NGHDylpYnjhjDd4QP2U9b5Zx4LZt34IdkJXJd6aaaT36Ex475tqV+gUXoOSnMt0z+7mZsGPs0nt8RnPjCs9P+Bn0W54WSFYnj1vjhjLdH9hB7z9UBfXoudCAYkctYPkYjhnMipR35Q9At6+XUAm9MZjxL/vdX8MQ7oncrTmXn7LELk4nOkJg;20:iuydZ5e4VTF9csqkG57gxwB/dbltRjL5DqaZPAoicJYxOGDj81j8HX0JifYSKKtXOBbi83pFSqdMW5prpjVMLbWoilwA7nsdfdx3HhwF57rlDyrKAQGUXV7EUQg3ulb0jWk55lEY0Mhymo1S9iRuo59cKBXBmoHKlInOHOZAM+M= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 04431fdc-ff6a-4bb2-3eef-08d59db1ad61 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0984; x-ms-traffictypediagnostic: DM5PR2101MB0984: 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)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0984;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0984; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(396003)(39860400002)(366004)(39380400002)(346002)(376002)(199004)(189003)(26005)(99286004)(2906002)(14454004)(97736004)(59450400001)(8676002)(81156014)(81166006)(8936002)(6512007)(106356001)(76176011)(186003)(3280700002)(10090500001)(36756003)(6506007)(66066001)(3660700001)(72206003)(478600001)(6666003)(53936002)(2900100001)(105586002)(102836004)(2501003)(110136005)(54906003)(5250100002)(486006)(1076002)(25786009)(6116002)(6436002)(11346002)(6486002)(22452003)(4326008)(446003)(7736002)(86362001)(305945005)(2616005)(476003)(8666007)(68736007)(3846002)(86612001)(5660300001)(10290500003)(107886003)(316002)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0984;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Hd60k0iFkyC2HVM9PnASXxNZdgW8161za50kwsyFD3xAaC/U/RZVdop36CjdmQjzKWfLv0N/7fjxmQt+FJzoFcjkooKS9KxE59SSvTm63DGPNzLZkWoNriYBBcvBtC+LhG1tJzQbn9tlCcMgF+JllV+9KBNxUaZKs61qakLESxoj5MmoExnFqesbxCe2pvOTM76O+b8apO2q+C0g0UKszubK+FSbSR5CnOdzRPnPqj3FKLN4Nyt1a3jBurZf0jho+hy7ibnJU0lwj6b/4T3rYfgu5xRXDXTsngzNpus8gMbRhdhpx6yGK+HLMiH+ZY+WO9CTa7bfAauRS2jY1wFAV7M9y/nHGck3zQLCyb09kGxqIjakia9C+IIRkEcy9ctGdOEv7jCtv01IaoBCZ1m2Fh5XS3+H0JaPjRtosrx29rw= 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: 04431fdc-ff6a-4bb2-3eef-08d59db1ad61 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:26:31.5352 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0984 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 bb36b1e1dbcc..775d4195966c 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -327,7 +327,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); @@ -383,7 +383,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