Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp300061yba; Fri, 5 Apr 2019 07:02:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6+LjZAu3LEbtZsNZrstEsX8EWvkkS2u3yuhR90YFDSo6mFleOAQos9HtqbpSVGj5Fsvzm X-Received: by 2002:a62:7549:: with SMTP id q70mr2670126pfc.112.1554472920560; Fri, 05 Apr 2019 07:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554472920; cv=none; d=google.com; s=arc-20160816; b=yiXzemHBTyCkfWtlMBZTm5Oe4TsVBR5sOLh7Kd5iWozwNAI8CCkGeeDOXIDC67Czs5 Gd7B2n3q98Ni/F7z9YtubzP2Pitj4J7j8gwNKIRfx0mpq4ym6a9pH5QaHcMyxIyn6CXt +hawLzT817G/cs0NCiNp395Ix6Dys4xSAGEyR33A4/022M/CmVepSS4nIZI5hT006gIU 4R73tWUFwmb+hcD9VblniefYv3co16xbtQlTZGLkzUptZ0Jg+eDIo93syTjNHTwX9AN+ chZS0F6PSiT3zGmCZ+4SjtXNuvdMGy5AQmP3eB25vn9gvnXt9y7UpvFH98OFCUDQWbLC nbJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IEMF7ox4iEiAa26UkQhA0XyeVs3TkWG/DVfePb52YMA=; b=rNr7tlBs6u4Tk7coVpdle/qyPzrQJRfwS26dhz/0ZY1r+W531uJ051ij9TK0fA01fB HvRTCYGZEhK4utUaSz86fYfL1mOWnnEqS9vTzi5vx26gsnI+dD1dew7l7InkAaiLOTCu xLuvp9sSoRF9Sj9F7aCq5bUZXhQvOEAvHrgcUtMOr89esYdmOIfsLkbpFk1MNnqOVpEm TCVDaw3JoJtBvhCt0zQEHCbosukRa0wPMEtNxLsWHS3m4HpFmuWNHYPz8h9obUede8aD ErfIYi44l63jGX1HX28aoHToztv0d0LRvOfQNWRGBNWdHPfdfTf1kVhKRn+xqZRciUUY LpEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tFVGo5js; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b37si19929003pla.155.2019.04.05.07.01.44; Fri, 05 Apr 2019 07:02:00 -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=@kernel.org header.s=default header.b=tFVGo5js; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731472AbfDEOAh (ORCPT + 99 others); Fri, 5 Apr 2019 10:00:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:47400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731445AbfDEOAd (ORCPT ); Fri, 5 Apr 2019 10:00:33 -0400 Received: from earth.universe (host-091-097-083-087.ewe-ip-backbone.de [91.97.83.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BB382186A; Fri, 5 Apr 2019 14:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554472833; bh=fsh/4e2YUoJ6mxG6gKftsBN+3Zc6eKt4TFqmWvOthcM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tFVGo5jsv7v2QhLvHC/FSjMhlrVL6lTv6MuFrA84ZpKo3+wGkVynXaTSXlYlmt/mL W45RXFcB8RZyiPPV60XkZB6SYttSYBZZEe5FIQ8sAkNw18BL8zVp7py9BafognDX58 dQhv9UkAk6YSIR55+9g1P9goOt9XpwlLjx2NgF8M= Received: by earth.universe (Postfix, from userid 1000) id 30ACF3C08D5; Fri, 5 Apr 2019 16:00:31 +0200 (CEST) Date: Fri, 5 Apr 2019 16:00:31 +0200 From: Sebastian Reichel To: Kangjie Lu Cc: pakki001@umn.edu, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] power: charger-manager: fix a potential NULL pointer dereference Message-ID: <20190405140031.6u35e5jd56aqms6o@earth.universe> References: <20190314060247.7848-1-kjlu@umn.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tkl3ivocftthn6sa" Content-Disposition: inline In-Reply-To: <20190314060247.7848-1-kjlu@umn.edu> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --tkl3ivocftthn6sa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, Mar 14, 2019 at 01:02:47AM -0500, Kangjie Lu wrote: > In case create_freezable_workqueue fails, the fix return -ENOMEM > to avoid a potential NULL pointer dereference. >=20 > Signed-off-by: Kangjie Lu > --- Thanks, queued. -- Sebastian > drivers/power/supply/charger-manager.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/suppl= y/charger-manager.c > index 38be91f21cc4..d29c4f338157 100644 > --- a/drivers/power/supply/charger-manager.c > +++ b/drivers/power/supply/charger-manager.c > @@ -1987,6 +1987,9 @@ static struct platform_driver charger_manager_drive= r =3D { > static int __init charger_manager_init(void) > { > cm_wq =3D create_freezable_workqueue("charger_manager"); > + if (unlikely(!cm_wq)) > + return -ENOMEM; > + > INIT_DELAYED_WORK(&cm_monitor_work, cm_monitor_poller); > =20 > return platform_driver_register(&charger_manager_driver); > --=20 > 2.17.1 >=20 --tkl3ivocftthn6sa Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlynX34ACgkQ2O7X88g7 +pqT4w//bt8j4QXMjCoJjbStIlmi1jhU7Zq0fcOE/O0PkQyArTOnQJ5cyvnvoDGv UfcaxNBLas4M1YXXVHZT7cp1GyZI21s/e0dPXvTNxpqd4SkipcdYGtRgkvj1s3yN +0Olt8vuomRr48a825+5sGL55tXCXJfOe9T5M8GGxvv4urNcy+U2JaO0pidnWZi0 cmVQ0oCRXiqFh24xfwpwJ0AB0O+yIpxqcXEXwTJ6F1nOXrEe+LpgSHginyCDET3s dvaiDBuYk6d36ZCmsN3rz80LE0jz6m9rZd0iVGi2jVACbSFgPvYlgJmJA8n3Hn+8 yBp2VcHqUrRLGFeLykLSxIRHd1Ahrtugmkn4eH4S920BhqqIdL1esVvnxRtQ7sce feIrzAPTNpVzS3O38CDExWEQrg9BCLnv6A+6QS3T/ediYH4p1agZSKXQluKIU4gq niS8142knFXQ2xCNBm8Np44ahjCwftjJ6pAH994fqTvF6kRQ6b5GgiUzjV16EL+i zdkS75qeNgOcbCrJEUgMcpa76Gk3/Mys5pA+2mq4qxWvejMH9Z2daL8N3zsPZ+Kp mqImJqaDMiLeQP6srTkuDrUHKQBAuDi+/mgrqLYUNw5HQnq/rDAHnUWvjN1puCDW FDoMlUlyy2U9o8O/KJjUvdeZX4Ts/OKU/FZOqRQLlTy5SKXV+ks= =u5jE -----END PGP SIGNATURE----- --tkl3ivocftthn6sa--