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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 9 Mar 2020 17:49:52 +0000
From:   Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>
Subject: [PATCH v3 1/2] nvmem: Allow nvmem_sysfs_get_groups() to return NULL
 as error condition

Currently, nvmem_register() does not check for NULL return from
nvmem_sysfs_get_groups(), and hence nvmem_sysfs_get_groups() has to
always return a valid group, even if it is given invalid inputs.

Add check in nvmem_register() to return an error if NULL group is given.

Signed-off-by: Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>
---
 drivers/nvmem/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index ef326f243..f6cd8a56a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -388,6 +388,10 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 			   config->read_only || !nvmem->reg_write;
 
 	nvmem->dev.groups = nvmem_sysfs_get_groups(nvmem, config);
+	if (!nvmem->dev.groups) {
+		kfree(nvmem);
+		return ERR_PTR(-EPERM);
+	}
 
 	device_initialize(&nvmem->dev);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ