lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  7 Jan 2022 11:35:16 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     rjw@...ysocki.net, lenb@...nel.org
Cc:     linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] ACPI: APD: Check for null pointer after calling devm_ioremap

As the possible failure of the devres_alloc(), the devm_ioremap() may
return NULL pointer.
And then, the 'clk_data->base' will be assigned to clkdev->data->base in
platform_device_register_data().
And the PTR_ERR_OR_ZERO() can not detect the 'base'.
Therefore, it should be better to add the check in order to guarantee
the success of the setup.

Fixes: 3f4ba94e3615 ("ACPI: APD: Add AMD misc clock handler support")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/acpi/acpi_apd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index 6e02448d15d9..9db6409ecb47 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -95,6 +95,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
 					      resource_size(rentry->res));
 		break;
 	}
+	if (!clk_data->base)
+		return -ENOMEM;
 
 	acpi_dev_free_resource_list(&resource_list);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ