Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3150436ybl; Sun, 8 Dec 2019 08:24:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxORHAYXBoq8/LGT8o1CQYCYnjVpSo9UuzQqrrkCggUwv42ymt6cu6mi4BYZoqtUCvOGcrV X-Received: by 2002:a05:6830:14c7:: with SMTP id t7mr9733757otq.72.1575822252858; Sun, 08 Dec 2019 08:24:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1575822252; cv=pass; d=google.com; s=arc-20160816; b=TVhhLtNxsIpQtCOt2lJWsQ2bHiJOQI6CMehl0pACaVjMAHr3NbRUPPbgOoXhwuRvT0 dekvPlHZQ+3BlkfCxe+ki4n3KpepO5H92tCOZeLiEk9txyiJMdtjiRYyNeSOO0ZUVwG0 KvhmX/M+0QBSiodPkNqcvLyO+kNo4JO3jaAmKY6fsOZxh/7YTvXOm9C3vteqxlktQ+Jf nT0C5IGXIejLx3L4c0Gq8aUS8YulP6V69qDfJb6VYnPHeeQOG8dBOc1O/f77o/sC//6h cCKV04GD05oUANZnUj72nllHbQqpUBHNa1v0i4kGCp+aGHGfRPkXAmHb9nZjtCiVPq/i UWuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=w+0zkJCswDwGT2QabveuRGVXEWQoofWbYIiABTJVLys=; b=eTarXH3JhOutrT67eNE6VSI7A0FbN7vbdIjFJd1kC+Pc4dyDkjqnDWvXLCv8POQUO8 G5RRiDi1ZDKeSaGea+a0NONEpxarmP/4YaaGhML9yg+sHFp5nQE0S+1hC6PDp2QxXwQs Fc3xi5jr36Z0VG/q3hNJ+MtNTr8Pqlkk9f4cxMX5TWso6jikag0DttbYfPi/iDsI5ZLR 7TVdkQYDkCMRavKDA7yntgC4D5S4+GfKbAXj35WRoXDkNHp32QH3aNRuK/jxRlVArodL GwsimnllVOW2vYjDhrybOEyxWnyavs9DSZ7sLMBu+miG0Tgw0lDRV53EKZQpKZEdLDDL me+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=ty840IIS; arc=pass (i=1 spf=pass spfdomain=mellanox.com dkim=pass dkdomain=mellanox.com dmarc=pass fromdomain=mellanox.com); 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=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si7299789oiy.116.2019.12.08.08.24.00; Sun, 08 Dec 2019 08:24:12 -0800 (PST) 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=@Mellanox.com header.s=selector1 header.b=ty840IIS; arc=pass (i=1 spf=pass spfdomain=mellanox.com dkim=pass dkdomain=mellanox.com dmarc=pass fromdomain=mellanox.com); 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=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbfLHQW0 (ORCPT + 99 others); Sun, 8 Dec 2019 11:22:26 -0500 Received: from mail-eopbgr10061.outbound.protection.outlook.com ([40.107.1.61]:63909 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726460AbfLHQW0 (ORCPT ); Sun, 8 Dec 2019 11:22:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wk04mAaG18VpxCK+XV++OHypQwVFCwaNOXxTn8Jv+qjRnHgsZKXRQB7M/4iFTnCC3dIE1gdpEuqlI+n65O7GWzJjVDV0CcfTqHjNxb30MQCsEJAEo+B8iWtWiNogV7e5MMha67LrDQysPTTHdUNd60pSS+tOmmmZnsVgI3b6vwwQBfG9JqDJWWFc762bGA8mbwfp+bmUbJfexS1CWMDIEl+BvPU+JX/OqU8RjGcZbZRUjYGNYtT/c5SY1N2Z2+IWno362QrdI0ATOn4WJGcWqeQoYAlQm8phtjcTwH93zE7U5/DZGhKZ3kOM7u8PLhFlZN6wj2vEV6zLUN4iAhbGUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w+0zkJCswDwGT2QabveuRGVXEWQoofWbYIiABTJVLys=; b=VVtob/9Dgs0WPT6BdCn6LfX3qDnUcQBM6HBVuYUvZEbesJDw4TcIDBMca8F+lsfXB3YRMZewkAM3dTtwA7zdlkBirdUq+d9hrmJMIYnHPVeEhmce48hCgmIjBJHoM3wwWvQNrx8H65rM2RGf4tsRniiZzjszbkkFthkjeFKYsXxgoGO58i0+/OKjTRH0A4ycJZa8D7ESyDuyqkzCwYOSasP3cFzoVUA6R54Ih3wNRe1JfuaFaKUJmKab4H/9/r6UFWpbZHpjeMzZgUvlSHz6Ah8X91KPUuJKcVKkJREeYYep/tbGS7DSsYEjCwvKv3GKaBk1/e5wa9NHh3xcTRPh7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w+0zkJCswDwGT2QabveuRGVXEWQoofWbYIiABTJVLys=; b=ty840IIS/FVRi9aestEy2b8Q6qrJR5b4NSkZt731/smyVuXBCKhqxvrUJtpDe4iPh0S2xPWk1BUd6wtwSy1FWN88q/Wou4aYJTBAHvr5y8XhlDTaVM1KI9tn/GiNcEOR2W83I7n451oPyZlnH1YX8+qz0l3Pc4B8pF6RvckI8Es= Received: from DB7PR05MB5338.eurprd05.prod.outlook.com (20.178.41.21) by DB7PR05MB5178.eurprd05.prod.outlook.com (20.178.42.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2516.14; Sun, 8 Dec 2019 16:22:19 +0000 Received: from DB7PR05MB5338.eurprd05.prod.outlook.com ([fe80::c18d:99a0:b973:685e]) by DB7PR05MB5338.eurprd05.prod.outlook.com ([fe80::c18d:99a0:b973:685e%6]) with mapi id 15.20.2516.018; Sun, 8 Dec 2019 16:22:19 +0000 From: Ido Schimmel To: Ben Hutchings CC: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , "akpm@linux-foundation.org" , Denis Kirjanov , Jiri Pirko , Zhang Rui , "wvw@google.com" Subject: Re: [PATCH 3.16 43/72] thermal: Fix use-after-free when unregistering thermal zone device Thread-Topic: [PATCH 3.16 43/72] thermal: Fix use-after-free when unregistering thermal zone device Thread-Index: AQHVrc8N/eZVk0ubv0iT/v06kKfr2Kewa7EA Date: Sun, 8 Dec 2019 16:22:18 +0000 Message-ID: <20191208162216.GA330015@splinter> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0173.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::17) To DB7PR05MB5338.eurprd05.prod.outlook.com (2603:10a6:10:64::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [79.182.107.67] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5592f9bd-f0e8-4eda-da8a-08d77bfacbd3 x-ms-traffictypediagnostic: DB7PR05MB5178:|DB7PR05MB5178: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0245702D7B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(7916004)(39860400002)(396003)(346002)(366004)(376002)(136003)(199004)(189003)(229853002)(33656002)(1076003)(478600001)(6916009)(4744005)(54906003)(6506007)(4326008)(26005)(102836004)(76176011)(8936002)(52116002)(99286004)(86362001)(186003)(316002)(71190400001)(71200400001)(64756008)(66446008)(66556008)(66476007)(5660300002)(66946007)(81166006)(8676002)(966005)(81156014)(305945005)(33716001)(6486002)(2906002)(6512007)(9686003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR05MB5178;H:DB7PR05MB5338.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: BiJGKAMcQ+sSkNDc200RbsfcD6dpk0hC/VDMezsWJPm6BaZQX7CZTYEPYRl00lMIEjx4ZFS1IaqmZ5WIBy6ADnJjVqD0bHgJzgFs7WO/d88CPsS+BFx7El+J2F4M3aDg8DXn9vlv9rm5w832mE68EXudNqRnWW9Wwuv79Rh4ZKgGrpMalhba8mb9qAaOp44c3f7WSAuIi68Nlz4igUfpKaGRB5ljZhk0MOrscArmgPzb8O3AwvDOHK+QbPXf0z8R6l3BGG91FpMTime10ujlKmFeuySbLTxQ/3cY89MqX5n8a06PEgGUiTjJAP0ncZW1Y0d6CZDVUZYGjw+gVc5FXOjbt+UKq66IYctoQX++vE99/486PgQij7sHN0e0aULpKgU08T6+zIxuFyo+msrmqQfpe7jby2Y2NiwMIPyqepFMjWq0KwvVWthY1uLFqROnrqrsJkVeb9ZRV08lftqJZ1CRZA/3n8Jc8ZNLRIeGax8= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5592f9bd-f0e8-4eda-da8a-08d77bfacbd3 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2019 16:22:18.9283 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vqFsjqlo4SBlB/y+cyC3F1pRmaek1ZR0rIVjXUtmZjyXBMCMIv4dIvWt2tK471RGawwF81TPUUgCp2gUQ9jwBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5178 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 08, 2019 at 01:53:27PM +0000, Ben Hutchings wrote: > 3.16.79-rc1 review patch. If anyone has any objections, please let me kn= ow. >=20 > ------------------ >=20 > From: Ido Schimmel >=20 > commit 1851799e1d2978f68eea5d9dff322e121dcf59c1 upstream. >=20 > thermal_zone_device_unregister() cancels the delayed work that polls the > thermal zone, but it does not wait for it to finish. This is racy with > respect to the freeing of the thermal zone device, which can result in a > use-after-free [1]. >=20 > Fix this by waiting for the delayed work to finish before freeing the > thermal zone device. Note that thermal_zone_device_set_polling() is > never invoked from an atomic context, so it is safe to call > cancel_delayed_work_sync() that can block. Ben, Wei Wang (copied) found a problem with this patch and fixed it: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?= id=3D163b00cde7cf2206e248789d2780121ad5e6a70b I believe you should take both patches to your tree. Thanks