[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63b64287-b402-c4c9-c977-e8d76dcbe686@huawei.com>
Date: Sat, 5 Nov 2022 09:39:10 +0800
From: "yekai (A)" <yekai13@...wei.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: <linux-crypto@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] crypto: hisilicon/qm - modify the process of regs dfx
On 2022/11/4 18:07, yekai (A) wrote:
>
> On 2022/11/4 17:05, Herbert Xu wrote:
>> On Sat, Oct 29, 2022 at 09:47:59AM +0000, Kai Ye wrote:
>>> diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
>>> index 363a02810a16..832cfd9a7728 100644
>>> --- a/drivers/crypto/hisilicon/qm.c
>>> +++ b/drivers/crypto/hisilicon/qm.c
>>> @@ -1722,8 +1722,22 @@ static int qm_regs_show(struct seq_file *s, void *unused)
>>>
>>> DEFINE_SHOW_ATTRIBUTE(qm_regs);
>>>
>>> +static void dfx_regs_uninit(struct hisi_qm *qm,
>>> + struct dfx_diff_registers *dregs, int reg_len)
>>> +{
>>> + int i;
>>> +
>>> + /* Setting the pointer is NULL to prevent double free */
>>> + for (i = 0; i < reg_len; i++) {
>>> + kfree(dregs[i].regs);
>>> + dregs[i].regs = NULL;
>>> + }
>>> + kfree(dregs);
>>> + dregs = NULL;
>> What's the point of this last NULL assignment?
>>
>> Cheers,
> To prevent pointer reuse and reduce register data security risks. So the original code setting the pointer is NULL.
>
> Thanks
> Kai
I misunderstood the pointer. There is no security data in the pointer. It is only a value transferred as a structure.
This patch-set does not modify the logic. Can i add an extra patch to delete this redundant line next version?
Thanks
Kai
Powered by blists - more mailing lists