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]
Message-ID: <20250615135212.1356469-1-alok.a.tiwari@oracle.com>
Date: Sun, 15 Jun 2025 06:52:07 -0700
From: Alok Tiwari <alok.a.tiwari@...cle.com>
To: srini@...nel.org, linux-kernel@...r.kernel.org
Cc: alok.a.tiwari@...cle.com, darren.kenny@...cle.com
Subject: [PATCH 1/2] nvmem: core: fix memory leak in nvmem_register() on error path

Ensure that the allocated nvmem structure is freed if device
registration return error code.
The missing kfree() caused a memory leak when nvmem_register()
exited via err_put_device label.

Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
---
 drivers/nvmem/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index fd2a9698d1c9..3203524ad49f 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1044,6 +1044,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 		nvmem_sysfs_remove_compat(nvmem, config);
 err_put_device:
 	put_device(&nvmem->dev);
+	kfree(nvmem);
 
 	return ERR_PTR(rval);
 }
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ