Received: by 10.213.65.68 with SMTP id h4csp2199104imn; Sun, 8 Apr 2018 22:18:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+z4aAMmdB6JjpKMmyadKdwVO+Tm6sr9jotyeBlz8gTyouwCSLbBmFQWxJPz8I9Vckc35zU X-Received: by 10.98.156.7 with SMTP id f7mr28247338pfe.104.1523251111439; Sun, 08 Apr 2018 22:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523251111; cv=none; d=google.com; s=arc-20160816; b=ETo8m63Y0s4y6QU/uNOtbBD6ab/cA3iBXqO/37HyLI8L/+oZ2gmpWWCBIPZLua70qQ cHJP9MSvuUlvheXJ28ExHTEcmKCtiyjU/NgVb6GONeDMchIAIaaijfqE05CpG60JPib0 qHbe/YJ2UVJdunvre8DeC5/2hqnkHVsHPu1N7XSLIj0CcyTVIFZcwWw/sqU/zKnJY5hJ LJDnNNxc8fpz/PXQZu7bGCLLLkPUlJ/rRTDL/NVGBCOz7BMcJzuAWxDZP+LpGxTzySGj lLiR2MQ5h84ayFE0xip99cRrNY3dV0gb3Y8k4xjj4Pe0/LKrqWHYQqwS96A43tUKEX6c fj5g== 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=6CeWI2K36M5/lckCn8QGqLvw6feOqKYCCl6qFu0QKx0=; b=0NAijddtfal6ffsbFW0HzkQNQuw8pPSm7wO+3KWVmrT2Q6AUwH9H+LPFEYnt2kvqbV Q6ZX6IULttvf0TmXLF3vDO1JWbpLgN7RjitVi4Ac/X8mEX8gSk5jYI/aYjO4L4NXJfkr cXEsccSzajb825uzMBTLCZlW9Rog70qhoF8ksoPwRpZpXwhU27D0xtHryCqXNFiqcz9Q Ej/xrDJUvyWOL9es5hmVOqGHIZzvu+K5rV2tZ+Jg0IU6FVqYBgGpsxUcjjkd04Xssmuw 6lSukqDZA+YvkUiivXiUWHCTvydJefzIQjItwkVXa+gRDTJn3+Y6Jbnlv9EZ6Fj/N9II 6+iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=PiW8jfU0; 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 l2si10458665pga.695.2018.04.08.22.17.54; Sun, 08 Apr 2018 22:18:31 -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=PiW8jfU0; 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 S1754378AbeDIAVI (ORCPT + 99 others); Sun, 8 Apr 2018 20:21:08 -0400 Received: from mail-sn1nam01on0114.outbound.protection.outlook.com ([104.47.32.114]:12752 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753254AbeDIAVE (ORCPT ); Sun, 8 Apr 2018 20:21:04 -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=6CeWI2K36M5/lckCn8QGqLvw6feOqKYCCl6qFu0QKx0=; b=PiW8jfU06rhitHbKlxSDB5ymFwR6/435ieVjn8CNAQUVB/V5NHa/o6Fwc4ZtBxseWSSHWGBe56DndfNnIWUdqQ/oS1o1vOMZf/msRhOEqfaF2DxW0k3Zf9D8T5liA3WjxzpQkJ3QfIEA9EYl+NuFTyjpxpTqKmTm0098YiZkxUk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0920.namprd21.prod.outlook.com (52.132.132.165) 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:20:58 +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:20:58 +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.15 153/189] xen/grant-table: Use put_page instead of free_page Thread-Topic: [PATCH AUTOSEL for 4.15 153/189] xen/grant-table: Use put_page instead of free_page Thread-Index: AQHTz5hWoeqpVbPRW0SZFZgCngoGtA== Date: Mon, 9 Apr 2018 00:18:51 +0000 Message-ID: <20180409001637.162453-153-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB0920;7:Meq0wbrSstCimBszwP+R9PBVHnG6oE0693Fokcsm9x+HZoPV1tFvWkRPurmh/w6JndTbdgWxs1CQ5/gZ0eyyNf82+x1h5shIVWV2Qq9bcc1ICXo4LTvzBvvwwgSxQd9mItBe42qrmX2IkQxZ+NuKY09ankpZFBR7XEkB+1yqliKfuwpbfqX4rV2GMkxRqG9esE1+CQrB9iTTejNZOh1Yj/wKcbZx4yvGvJgGYxqHiPLaUhZCz4Gj81kMIZrcNO9F;20:uCTtiQjDGCgkXCcLHcc1aNE1LuWnQgVG2YnOhGIdlDgTzGWzZmDWUOyg/zG0MAY4qb6SN/59SJEsbcHbxYEaHws+EDJfyeBVHIJpLNiReGYukvtpGlexYqEMrpiR2WO7bg+HT/o4QDPTEA6U9npTOx0Z/8HwVtkTzH46oUwpxdw= X-MS-Office365-Filtering-Correlation-Id: 9d6c2a98-ccf4-4b58-4c8e-08d59dafc477 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:DM5PR2101MB0920; x-ms-traffictypediagnostic: DM5PR2101MB0920: 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:DM5PR2101MB0920;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0920; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(396003)(366004)(346002)(376002)(199004)(189003)(66066001)(86362001)(59450400001)(3660700001)(3280700002)(25786009)(76176011)(2900100001)(36756003)(6506007)(2906002)(99286004)(86612001)(6486002)(102836004)(305945005)(1076002)(7736002)(97736004)(2616005)(446003)(11346002)(476003)(486006)(26005)(6666003)(6512007)(4326008)(107886003)(5660300001)(478600001)(6436002)(105586002)(10290500003)(5250100002)(22452003)(316002)(8666007)(186003)(8676002)(110136005)(81166006)(54906003)(6116002)(8936002)(72206003)(53936002)(2501003)(3846002)(68736007)(14454004)(81156014)(10090500001)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0920;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: X+DC1BYbyN1P1PCoOFtbbIBwWvi/sRyXY6WvEZQNaqNbuZXEeCQdB/CnMMkCV0VWr8ZM0UhXJltX/IHSFi/QAfdlMtwnriOHiG4oksVqVb7ZzAFyseNPGe2Mx7pHNjVSqixDFFSgkO4uAFvj0RpAzq/u0iWtPM0v9FkhOgPE/vqMRMfyVGWJ0vXEZtje9TdzIOdYo5IDnjk8EU6iyUUrllCI/XHlC+raVkHnW1raRoJ7gbiiAsI+Z03uaeGqHwxb9SNKwG3zOd3SGs8Mne8QmkDiBJYpmgWMa1tfJYwLWYlWNfhqx7XMu5AAbPMQ+1rvVGMufIbx3TpiH6rei1TtJkNp0L/nOkUzuKrqiQ+yfrzQJZSodwF5dXOniuFfFQuqPv9ZoxJRrXqfBIakg0lWwK1L5LRhjk25n8pJchIzwS0= 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: 9d6c2a98-ccf4-4b58-4c8e-08d59dafc477 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:51.5965 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0920 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 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 *u= nused) 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 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