Received: by 10.213.65.68 with SMTP id h4csp1684583imn; Mon, 19 Mar 2018 10:29:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELuPHtA2o2omvwvB/JdZoT8TN8VrCX13dBD1abOzYF4rOLvd/qgEzx7236NO5lDinKhF6OCX X-Received: by 10.98.81.133 with SMTP id f127mr10938809pfb.20.1521480585304; Mon, 19 Mar 2018 10:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521480585; cv=none; d=google.com; s=arc-20160816; b=L+QW3ev0XFyaMXLPXXUtw3eVbPOkV/P52UxEz7b1R8VNiV9FM2pANidkGFgbFSFlz+ KipUlzz9bOEb2bxctyI4iJtoShaUA/F9xFkFRv7RBmEehEiQN7dGBkumot0xtuCW8jIk ftoVcYma+T+K9rxLKFxJoR79UI2VcUPi+qP87obQSK6+c0Xol0V5rErese44uTs5NPxz iQSwxdEhIuEXRqSbEuhzvoMGUElEzNo/0vEZCdCUxZ+aqX2eIYYutsoP2Wq6izTbAfc7 8zmA3zSZBpvGbQntEBcS7hyMFdX8G0kmCjZ3n0SMj2q41fIbShsrzUN5lrzhQ6VbtuRx KPxQ== 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=z6PmXYMUjm3hDu4m6ceWmJf1yO3MggF5HNcoBwfQN2k=; b=pzR/wS+jAYqchgbZWqTmB1Q6Hk5bBivS+AK2FArV2lmDAq6JWW1WK5Ql29JzqIQS4y SeHdNLvZLvseEQ9QWWN3mfnLkqrwXntEcEILuUMsNGSrXZdcpk1JaS79/28ebcVsoC0C DGpz0WjPEOFblWZDKB22bta4UKeAwq6CAriOj0xASO6v8nSSE2NDCILtk5EEJh0cw/II VWe2mmwt8alNdgfzp7LVM/Buf+L6qesEzni6eqcQkgaR5ZSk9vl7PyD8gqJEzb+wizef bNEKfvevMwRRdASWyAtbHVXGvW/sPq4GOYf/H73xm/qVKgD+p0ZOC8l5IahQcRa/lTic w6QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=jhzjEQOR; 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 t22-v6si370243plj.233.2018.03.19.10.29.31; Mon, 19 Mar 2018 10:29:45 -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=jhzjEQOR; 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 S966212AbeCSQHp (ORCPT + 99 others); Mon, 19 Mar 2018 12:07:45 -0400 Received: from mail-co1nam03on0134.outbound.protection.outlook.com ([104.47.40.134]:37597 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965703AbeCSQHg (ORCPT ); Mon, 19 Mar 2018 12:07:36 -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=z6PmXYMUjm3hDu4m6ceWmJf1yO3MggF5HNcoBwfQN2k=; b=jhzjEQORgshkV0RpXn/qF3rrjN3SSPBrGWbqkP554nlO6g0LNRSlclPB/3NaXOzHwlicC4eJGnFWjrjdUWTtb2ueDLLjYzirHmLkRYYiZgG4TUWNaDow3ObgAFqc/iIC/PZZRvVhtHBdxjbmK36x3dYHTJRsnXDSb/TVpOc58ts= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1093.namprd21.prod.outlook.com (52.132.130.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:07:32 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:07:32 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Dan Carpenter , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 032/167] PowerCap: Fix an error code in powercap_register_zone() Thread-Topic: [PATCH AUTOSEL for 4.4 032/167] PowerCap: Fix an error code in powercap_register_zone() Thread-Index: AQHTv5wsUpyfC9GmZk2yTFdG3IEuHQ== Date: Mon, 19 Mar 2018 16:06:01 +0000 Message-ID: <20180319160513.16384-32-alexander.levin@microsoft.com> References: <20180319160513.16384-1-alexander.levin@microsoft.com> In-Reply-To: <20180319160513.16384-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;DM5PR2101MB1093;7:4BMZqpEbiGj+wpmGhvbzD3bHQ828iztiPedX04yPRaLQSRy/aO8L8UbrRVBPYW5Jmmg7TkyW+zlKAMIGKwNxuez73gCe768Iyjb6DFXDr9IVkpgeRaPx9Fi5jF3y6ZGv4LtKiSTvjBvFLlDlrP3i5JWtffD2dIl1EPXbn8FC4Wb0unOna55RapB3RITp399LIXthN7yWHbimaETUVanBh8Td4nBUm6V2VVDPtVrgtVjafK3TD1pI1xYo6HBdpU1G;20:uhGhKLLggysg6nFe1D0XvXfnrpSsQccwKTfqVTtBMxuHlw9p74DkV1VlzOodSzLX8rr5tZ7i5SSvu+XwDoAM4/rB4gfBBHSTipMyndUibSOlk2OeXx0RP4YjgzMA2XYC35VFy2emqfo6CJCxF4iQR4qFgU1t+94envzKOUvHWGI= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 99c8a781-0c47-4a3e-93b4-08d58db3858f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1093; x-ms-traffictypediagnostic: DM5PR2101MB1093: 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)(146099531331640)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1093;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1093; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(376002)(396003)(39380400002)(366004)(39860400002)(346002)(189003)(199004)(10290500003)(68736007)(478600001)(110136005)(72206003)(36756003)(99286004)(97736004)(10090500001)(305945005)(7736002)(6666003)(76176011)(107886003)(2950100002)(6436002)(86612001)(6486002)(4326008)(54906003)(186003)(3660700001)(25786009)(26005)(2906002)(53936002)(575784001)(5250100002)(2501003)(81166006)(81156014)(2900100001)(86362001)(5660300001)(8936002)(1076002)(8676002)(3846002)(3280700002)(6116002)(66066001)(316002)(6506007)(14454004)(106356001)(6512007)(22452003)(105586002)(102836004)(22906009)(217873001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1093;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: ZOSojU9g2AwVXVoRJnPD/v8IDMtlZo9X4QId57KQB5iW+TCOqeXy3urrJKZ4MqPcNd1tz2WdXm3fzqYQfGkqwkiUZyTveL7s1oTD8iE1KPni3NkvAlMATUs9LxImy7U+oBr0MG/ghy6+FSbe479pMMaB8L6QtBlY5a6zl+xQlUwGumHzhdeji34lUOL5lK6z8SR2+PNY5KIwXrtwm9aWMP2oMvURqsLJmFhVNnaZDirpxE35snvYswZyJJlWwsYOxZy5DHLib0PZtn2XRYJrSe9Nyal1byKF9b90rWpjKGfOzDQcLAsQ3VxvjhiCurBSIp63SkrNw06x7qcEtRsSfg== 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: 99c8a781-0c47-4a3e-93b4-08d58db3858f X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:06:01.4581 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1093 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 216c4e9db4c9d1d2a382b42880442dc632cd47d9 ] In the current code we accidentally return the successful result from idr_alloc() instead of a negative error pointer. The caller is looking for an error pointer and so it treats the returned value as a valid pointer. This one might be a bit serious because if it lets people get around the kernel's protection for remapping NULL. I'm not sure. Fixes: 75d2364ea0ca (PowerCap: Add class driver) Signed-off-by: Dan Carpenter Reviewed-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/powercap/powercap_sys.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sy= s.c index 84419af16f77..fd12ccc11e26 100644 --- a/drivers/powercap/powercap_sys.c +++ b/drivers/powercap/powercap_sys.c @@ -538,6 +538,7 @@ struct powercap_zone *powercap_register_zone( =20 power_zone->id =3D result; idr_init(&power_zone->idr); + result =3D -ENOMEM; power_zone->name =3D kstrdup(name, GFP_KERNEL); if (!power_zone->name) goto err_name_alloc; --=20 2.14.1