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>] [day] [month] [year] [list]
Message-ID: <tencent_713C9C4229EF3F0CE48CF93A9794C3862205@qq.com>
Date:   Mon, 13 Dec 2021 16:16:31 +0800
From:   Xiaoke Wang <xkernel.wang@...mail.com>
To:     keescook@...omium.org, anton@...msg.org, ccross@...roid.com,
        tony.luck@...el.com
Cc:     linux-kernel@...r.kernel.org,
        Xiaoke Wang <xkernel.wang@...mail.com>
Subject: Re: [PATCH] pstore/platform: check the return value of kstrdup()

Note: Compare with the last email, this one is using my full name.
kstrdup() returns NULL when some internal memory errors happen, it is
better to checkk the return value of it. Otherwise, some memory errors
will not be catched in time and may also further result in wrong memory
access.

Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
---
 fs/pstore/platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index b9614db..f7c8732 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -620,6 +620,11 @@ int pstore_register(struct pstore_info *psi)
 	 * through /sys/module/pstore/parameters/backend
 	 */
 	backend = kstrdup(psi->name, GFP_KERNEL);
+	if (!backend) {
+		pr_err("out of memory duplicating '%s'\n", psi->name);
+		mutex_unlock(&psinfo_lock);
+		return -ENOMEM;
+	}
 
 	pr_info("Registered %s as persistent store backend\n", psi->name);
 
-- 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ