From b38c323b04e20aac6037c01d2560a7e21266948c Mon Sep 17 00:00:00 2001 From: "Kun(llfl)" Date: Mon, 18 Sep 2023 17:20:58 +0800 Subject: [PATCH] anolis: crypto: iax: fix unexpected softlockup while enabling iax_crypto ANBZ: #6403 when excuting "echo 1 > /iax_crypto_module_sysfs_root/iax_crypto_enable" to enable iax_crypto, softlockup occurred. Because command "echo" in bash adds a "\n" right after contents. Then the driver gets "1\n" from sysfs, but cannot process "\n" properly. So the unexpected softlockup and "invalid argument" come up. Signed-off-by: Kun(llfl) --- drivers/crypto/iax/iax_crypto_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/iax/iax_crypto_main.c b/drivers/crypto/iax/iax_crypto_main.c index 9fc6067e93d2..ac28f7f173c3 100644 --- a/drivers/crypto/iax/iax_crypto_main.c +++ b/drivers/crypto/iax/iax_crypto_main.c @@ -133,7 +133,7 @@ static int iax_crypto_enable(const char *val, const struct kernel_param *kp) /* accept 'Yy1Nn0', or [oO][NnFf] for "on" and "off". */ ret = kstrtobool(val, &flag); if (ret) - return ret; + goto skipping; if (!flag) { if (!iax_crypto_enabled) goto skipping; @@ -145,10 +145,13 @@ static int iax_crypto_enable(const char *val, const struct kernel_param *kp) ret = iax_all_wqs_get(); if (ret < 0) pr_err("%s: iax_crypto enable failed: ret=%d\n", __func__, ret); - else if (ret == 0) + else if (ret == 0) { pr_info("%s: no wqs available, not enabling iax_crypto\n", __func__); - else + ret = -ENODEV; + } else { iax_crypto_enabled = true; + ret = 0; + } } skipping: -- Gitee