diff mbox series

[v3] crypto: s5p-sss - Add error handling in s5p_aes_probe()

Message ID 20211021013422.21396-1-tangbin@cmss.chinamobile.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v3] crypto: s5p-sss - Add error handling in s5p_aes_probe() | expand

Commit Message

Tang Bin Oct. 21, 2021, 1:34 a.m. UTC
The function s5p_aes_probe() does not perform sufficient error
checking after executing platform_get_resource(), thus fix it.

Fixes: c2afad6c6105 ("crypto: s5p-sss - Add HASH support for Exynos")
Cc: <stable@vger.kernel.org>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
Changes from v2
 - add Cc: <stable@vger.kernel.org>

Changes from v1
 - add fixed title
---
 drivers/crypto/s5p-sss.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Herbert Xu Oct. 29, 2021, 1:11 p.m. UTC | #1
On Thu, Oct 21, 2021 at 09:34:22AM +0800, Tang Bin wrote:
> The function s5p_aes_probe() does not perform sufficient error
> checking after executing platform_get_resource(), thus fix it.
> 
> Fixes: c2afad6c6105 ("crypto: s5p-sss - Add HASH support for Exynos")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
> Changes from v2
>  - add Cc: <stable@vger.kernel.org>
> 
> Changes from v1
>  - add fixed title
> ---
>  drivers/crypto/s5p-sss.c | 2 ++
>  1 file changed, 2 insertions(+)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index 55aa3a711..7717e9e59 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -2171,6 +2171,8 @@  static int s5p_aes_probe(struct platform_device *pdev)
 
 	variant = find_s5p_sss_version(pdev);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
 
 	/*
 	 * Note: HASH and PRNG uses the same registers in secss, avoid