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-next>] [day] [month] [year] [list]
Date:   Tue, 18 Jul 2023 14:55:31 +0100
From:   Daniel Golle <daniel@...rotopia.org>
To:     Miquel Raynal <miquel.raynal@...tlin.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] nvmem: core: clear sysfs attributes for each NVMEM device

Set nvmem_cells_group.bin_attrs to NULL in case of an NVMEM device not
having any cells in order to make sure sysfs attributes of a previously
registered NVMEM device are not accidentally reused for a follow-up
device which doesn't have any cells.

Fixes: 757f8b3835c9 ("nvmem: core: Expose cells through sysfs")
Signed-off-by: Daniel Golle <daniel@...rotopia.org>
---
 drivers/nvmem/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 6c04a9cf6919f..70e951088826d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -458,9 +458,10 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
 
 	mutex_lock(&nvmem_mutex);
 
-	if (list_empty(&nvmem->cells))
+	if (list_empty(&nvmem->cells)) {
+		nvmem_cells_group.bin_attrs = NULL;
 		goto unlock_mutex;
-
+	}
 	/* Allocate an array of attributes with a sentinel */
 	ncells = list_count_nodes(&nvmem->cells);
 	cells_attrs = devm_kcalloc(&nvmem->dev, ncells + 1,
-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ