Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3497378imm; Sun, 17 Jun 2018 21:57:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKwi7nKoJ4HalIPkjJRs3mF42qZjWTmGv6951rC9enJEjb7wIu/KrGdIEEXLXvLZFJHPmtz X-Received: by 2002:a17:902:6802:: with SMTP id h2-v6mr12313755plk.113.1529297851971; Sun, 17 Jun 2018 21:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529297851; cv=none; d=google.com; s=arc-20160816; b=ClPI/JWxnlXTcGS751Fpw4AtCJcJ97Q1DkGdxTrXBl5Rijxn+4/8ceugkgAWd+2OQN sFCcLB4DIbIkkIZCEze9MVmH9bP9rrkekumS9tXRPuSollgM/282vAAZ6DeEXiIMh9hT 79bCH82hwgV/yUb5BrDMsIDUo281yWYQMWVRUcWXZc4dgw/OuaSyvxxGWwRiBH87sTFR 5zGhjxdHI+aE1+LSPerIZAmwbvK7YWaVjq7bUtIzkhPW1MEX9CBNe4WkjiKPowb0FaWa xxgBiz1crPth5AHsgPdpPJM1Qmsc9Jtc+1Xzo7sR2jADvmo7Cpl5qzFW2j0WV7mbtC/K eL9g== 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:arc-authentication-results; bh=N+mUPoeRV+ZCimlzTxr/kcVrlScxw00s1WJcGkEGoIY=; b=TEwi26BlUPuh93NQ+miZWWAHh5qImm72QQ8pBpO4zaCXtlZA7QgS0jUgdDc+T0/jSd 13vqOIOuhhJUrbPn6Sh1hadyv/YWPC2X/kqrmFbma3AII4SaORPNLrL77PeKxxi00NAj wU4ZvLHFTEY/7usQwK9FltwVaHf5JlvpQ2A04QlqzKu4Dnx9ni2Wk8i4L+bgSL9pBphk 0oeGstlva6VxpxwbXCV9Yx7kXV1U3Kduqge64cFFYmmjAfJIoeoWDRpwKrT5lUhcz4YW pmQ/SR0IULRB/hXspn/tb6enRm7CyVgk0K4rKzPxBQWm1xGqDv1R7SpEvtLxkG9rpYuC U1YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d6OIX2YR; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 74-v6si14029337pfp.161.2018.06.17.21.57.18; Sun, 17 Jun 2018 21:57: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=@linaro.org header.s=google header.b=d6OIX2YR; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544AbeFREz2 (ORCPT + 99 others); Mon, 18 Jun 2018 00:55:28 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:45349 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753936AbeFREz0 (ORCPT ); Mon, 18 Jun 2018 00:55:26 -0400 Received: by mail-pl0-f67.google.com with SMTP id c23-v6so8325213plz.12 for ; Sun, 17 Jun 2018 21:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=N+mUPoeRV+ZCimlzTxr/kcVrlScxw00s1WJcGkEGoIY=; b=d6OIX2YRUG0mEzc02K763Bd1LbqVfJZc9BJ5UFLg9z9vZZOy43WCybpGXZLUK67ZNt 4p35WKi/yxVfL4/w2Q9YuhOxqqPpAHpW1xgV4Od2uzaxXQ1Bm0cMgackyKMdMDR1YXuO rWbp4zk5jtYH6oVNehicfjYI79WFx78tPAjls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=N+mUPoeRV+ZCimlzTxr/kcVrlScxw00s1WJcGkEGoIY=; b=W11ZwvRDBTduYZrSPqrxdUOBQTUS9pwcbbfNKX0V9I1w32/OTZ+sIxXjOBuMCbn3rU meJd8yb/uAzSQ3OxTQSQ+3XP4i0I5ZPw64L/hVOKEspIpRGvmEb85hMbuUquMDsY0Lvv pWY4k4cp2oBSLIz0GZQZ0EXaTf873YWyDU3CO0cho537L3bLjoOkGOtLMDJB0S9Z+hui MsS7j2i1x8E5n1gFrPqKwo540Nk7UPqhtPMRuKpxXL1yZJyCGCU2IBK/3jngCATLZjMX l1unK0sqwWyfYumJkTRsHKyOvwNq1Jw5JKBEYRi5f3e/29Zcv2LPkcfg8eotwfxYtNC5 nEIA== X-Gm-Message-State: APt69E1OQ3umxEEwFW1l2SdkwHfqe34Cs8G9oNbQk33AOqRfuxZRGsf7 cYBfHBFRQiKGqggVi8B9dFLC2Lzr1OM= X-Received: by 2002:a17:902:1127:: with SMTP id d36-v6mr12579413pla.267.1529297726314; Sun, 17 Jun 2018 21:55:26 -0700 (PDT) Received: from localhost ([122.172.130.27]) by smtp.gmail.com with ESMTPSA id 74-v6sm4155970pfj.127.2018.06.17.21.55.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 21:55:25 -0700 (PDT) Date: Mon, 18 Jun 2018 10:25:23 +0530 From: Viresh Kumar To: ilia.lin@gmail.com Cc: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] cpufreq: kryo: Fix possible error code dereference Message-ID: <20180618045523.p5keat3323wymvpu@vireshk-i7> References: <20180614202921.32535-1-ilia.lin@gmail.com> <20180617195842.22818-1-ilia.lin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180617195842.22818-1-ilia.lin@gmail.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-06-18, 21:58, ilia.lin@gmail.com wrote: > From: Ilia Lin > > In event of error returned by the nvmem_cell_read() non-pointer value > may be dereferenced. Fix this with error handling. > Additionally free the allocated speedbin buffer, as per the API. > > Fixes: 9ce36edd1a52 (cpufreq: Add Kryo CPU scaling driver) > Signed-off-by: Ilia Lin > --- > drivers/cpufreq/qcom-cpufreq-kryo.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c > index d049fe4b80c4..74b9b93d511b 100644 > --- a/drivers/cpufreq/qcom-cpufreq-kryo.c > +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c > @@ -115,6 +115,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > > speedbin = nvmem_cell_read(speedbin_nvmem, &len); > nvmem_cell_put(speedbin_nvmem); > + if (IS_ERR(speedbin)) > + return PTR_ERR(speedbin); > > switch (msm8996_version) { > case MSM8996_V3: > @@ -127,6 +129,7 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > BUG(); > break; > } > + kfree(speedbin); > > for_each_possible_cpu(cpu) { > cpu_dev = get_cpu_device(cpu); Ideally this should have been two patches as you were fixing two different problems. But anyway, you can go through this time. Acked-by: Viresh Kumar -- viresh