lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10cbe6fb-05b8-3219-cef5-05980559f053@linaro.org>
Date:   Tue, 22 Oct 2019 17:44:21 +0100
From:   Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To:     Amit Kucheria <amit.kucheria@...aro.org>,
        Colin King <colin.king@...onical.com>
Cc:     Andy Gross <agross@...nel.org>, Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        AngeloGioacchino Del Regno <kholk11@...il.com>,
        Linux PM list <linux-pm@...r.kernel.org>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] thermal: qcom: tsens-v1: fix kfree of a non-pointer
 value



On 22/10/2019 14:06, Amit Kucheria wrote:
> On Tue, Oct 22, 2019 at 4:48 PM Colin King <colin.king@...onical.com> wrote:
>>
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> Currently the kfree of pointer qfprom_cdata is kfreeing an
>> error value that has been cast to a pointer rather than a
>> valid address.  Fix this by removing the kfree.
> 
> Hmm, we just added this to other places[1] as a fix for mem leaks
> using the nvmem api. >
This patch has nothing to do with the memleak fix.
> I think we need to fix up the qfprom_read wrapper. Srini?

not sure how we can fix that, as the pointer returned from read is needs 
to be freed by the caller after its done with it!

--srini


> 
> [1] https://lore.kernel.org/stable/20191010083616.685532154@linuxfoundation.org/

> 
>> Fixes: 95ededc17e4e ("thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976")
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>> ---
>>   drivers/thermal/qcom/tsens-v1.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
>> index 2d1077b64887..bd2ddb684a45 100644
>> --- a/drivers/thermal/qcom/tsens-v1.c
>> +++ b/drivers/thermal/qcom/tsens-v1.c
>> @@ -240,10 +240,8 @@ static int calibrate_8976(struct tsens_priv *priv)
>>          u32 *qfprom_cdata;
>>
>>          qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
>> -       if (IS_ERR(qfprom_cdata)) {
>> -               kfree(qfprom_cdata);
>> +       if (IS_ERR(qfprom_cdata))
>>                  return PTR_ERR(qfprom_cdata);
>> -       }
>>
>>          mode = (qfprom_cdata[4] & MSM8976_CAL_SEL_MASK);
>>          dev_dbg(priv->dev, "calibration mode is %d\n", mode);
>> --
>> 2.20.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ