From: "yekai (A)" <yekai13@huawei.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] crypto: hisilicon/qm - modify the process of regs dfx
Date: Fri, 4 Nov 2022 18:07:05 +0800 [thread overview]
Message-ID: <851c1b30-ee30-145b-c77c-17166cd6e426@huawei.com> (raw)
In-Reply-To: <Y2TV6Cz7XPYj4SZO@gondor.apana.org.au>
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
next prev parent reply other threads:[~2022-11-04 10:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 9:47 [PATCH 0/3] crypto: hisilicon/qm - reconstruct and optimize the debugfs code Kai Ye
2022-10-29 9:47 ` [PATCH 1/3] crypto: hisilicon/qm - modify the process of regs dfx Kai Ye
2022-11-04 9:05 ` Herbert Xu
2022-11-04 10:07 ` yekai (A) [this message]
2022-11-05 1:39 ` yekai (A)
2022-11-05 2:45 ` Herbert Xu
2022-10-29 9:48 ` [PATCH 2/3] crypto: hisilicon/qm - split a debugfs.c from qm Kai Ye
2022-10-29 9:48 ` [PATCH 3/3] crypto: hisilicon/qm - the command dump process is modified Kai Ye
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=851c1b30-ee30-145b-c77c-17166cd6e426@huawei.com \
--to=yekai13@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox