* Re: [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
[not found] <96ffa633-dda1-7ad1-72da-5563906c1561@web.de>
@ 2020-08-05 1:58 ` shenyang (M)
[not found] ` <5554863d-f0d7-a396-7d13-e187fa9ca6bf@web.de>
0 siblings, 1 reply; 4+ messages in thread
From: shenyang (M) @ 2020-08-05 1:58 UTC (permalink / raw)
To: Markus Elfring, Sihang Chen, linux-crypto
Cc: linux-kernel, kernel-janitors, David S. Miller, Herbert Xu,
Zaibo Xu, Zhou Wang
On 2020/8/5 2:34, Markus Elfring wrote:
> …
>> +++ b/drivers/crypto/hisilicon/qm.c
>> @@ -1420,16 +1420,17 @@ static int qm_dbg_help(struct hisi_qm *qm, char *s)
> …
>> + s_tmp = s;
>> presult = strsep(&s, " ");
>> if (!presult) {
>> - kfree(s);
>> + kfree(s_tmp);
>> return -EINVAL;
>> }
>
> - kfree(s);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto free_tmp;
>
> I suggest to add a jump target for the desired exception handling.
>
> Regards,
> Markus
>
> .
>
Thanks for your review. There is only one error branch need to do
something uninit. So I think the jump is not necessary and will
affect code reading.:)
Thanks,
Yang
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 00/10] crypto: hisilicon/qm - misc fixes
@ 2020-08-04 13:58 Yang Shen
2020-08-04 13:58 ` [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep Yang Shen
0 siblings, 1 reply; 4+ messages in thread
From: Yang Shen @ 2020-08-04 13:58 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel, linux-crypto, xuzaibo, wangzhou1
This patchset fix some qm bugs:
patch 1: store the string address before pass to 'strsep'
patch 2: clear 'qp_status->used' when init the 'qp'
patch 3: use 'dev_info_ratelimited' to avoid printk flooding.
patch 4: fix the judgement of queue is full
patch 7: save the vf configuration space to make sure it is available
after the 'PF' 'FLR'
patch 8: register callback to 'pci_driver.shutdown'
patch 9: wait for all working function finishs when remove the device
patch 10: move the process of register alg to crypto in driver 'hisi_zip'
v4:
- exchange the patch 'fix the call trace when unbind device' and
'fix the process of register algorithms to crypto' to make sure the
driver is stable.
v3:
- add the patch 10 which is aimed to fix the call trace when remove a
working device
v2:
- fix the wrong email address on patch 1
Hui Tang (1):
crypto: hisilicon/qm - fix judgement of queue is full
Shukun Tan (3):
crypto: hisilicon/qm - clear used reference count when start qp
crypto: hisilicon/qm - fix event queue depth to 2048
crypto: hisilicon/qm - fix VF not available after PF FLR
Sihang Chen (1):
crypto: hisilicon/qm - fix wrong release after using strsep
Weili Qian (1):
crypto: hisilicon/qm - fix the call trace when unbind device
Yang Shen (4):
crypto: hisilicon/qm - fix print frequence in hisi_qp_send
crypto: hisilicon/qm - fix no stop reason when use 'hisi_qm_stop'
crypto: hisilicon/qm - register callback function to
'pci_driver.shutdown'
crypto: hisilicon/qm - fix the process of register algorithms to
crypto
drivers/crypto/hisilicon/hpre/hpre_crypto.c | 36 ++---
drivers/crypto/hisilicon/hpre/hpre_main.c | 28 ++--
drivers/crypto/hisilicon/qm.c | 221 ++++++++++++++++++++++++----
drivers/crypto/hisilicon/qm.h | 27 ++--
drivers/crypto/hisilicon/sec2/sec_crypto.c | 35 ++---
drivers/crypto/hisilicon/sec2/sec_main.c | 34 ++---
drivers/crypto/hisilicon/zip/zip_crypto.c | 2 +-
drivers/crypto/hisilicon/zip/zip_main.c | 49 +++---
8 files changed, 288 insertions(+), 144 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep
2020-08-04 13:58 [PATCH v4 00/10] crypto: hisilicon/qm - misc fixes Yang Shen
@ 2020-08-04 13:58 ` Yang Shen
0 siblings, 0 replies; 4+ messages in thread
From: Yang Shen @ 2020-08-04 13:58 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel, linux-crypto, xuzaibo, wangzhou1
From: Sihang Chen <chensihang1@hisilicon.com>
Save the string address before pass to strsep, release it at end.
Because strsep will update the string address to point after the
token.
Fixes: c31dc9fe165d("crypto: hisilicon/qm - add DebugFS for xQC and...")
Signed-off-by: Sihang Chen <chensihang1@hisilicon.com>
Signed-off-by: Yang Shen <shenyang39@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
---
drivers/crypto/hisilicon/qm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 6527c53..ffb28cc 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -1420,16 +1420,17 @@ static int qm_dbg_help(struct hisi_qm *qm, char *s)
static int qm_cmd_write_dump(struct hisi_qm *qm, const char *cmd_buf)
{
struct device *dev = &qm->pdev->dev;
- char *presult, *s;
+ char *presult, *s, *s_tmp;
int ret;
s = kstrdup(cmd_buf, GFP_KERNEL);
if (!s)
return -ENOMEM;
+ s_tmp = s;
presult = strsep(&s, " ");
if (!presult) {
- kfree(s);
+ kfree(s_tmp);
return -EINVAL;
}
@@ -1459,7 +1460,7 @@ static int qm_cmd_write_dump(struct hisi_qm *qm, const char *cmd_buf)
if (ret)
dev_info(dev, "Please echo help\n");
- kfree(s);
+ kfree(s_tmp);
return ret;
}
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-07 8:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <96ffa633-dda1-7ad1-72da-5563906c1561@web.de>
2020-08-05 1:58 ` [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep shenyang (M)
[not found] ` <5554863d-f0d7-a396-7d13-e187fa9ca6bf@web.de>
2020-08-06 1:33 ` [v4 " shenyang (M)
[not found] ` <c28f472c-4d7b-0afd-5ad7-3cc322aad404@web.de>
2020-08-07 8:06 ` shenyang (M)
2020-08-04 13:58 [PATCH v4 00/10] crypto: hisilicon/qm - misc fixes Yang Shen
2020-08-04 13:58 ` [PATCH v4 01/10] crypto: hisilicon/qm - fix wrong release after using strsep Yang Shen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®