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: <644f44ad-7e2b-4a1a-bbd7-ccc79d479242@web.de>
Date: Wed, 17 Jan 2024 21:24:12 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-hardening@...r.kernel.org, kernel-janitors@...r.kernel.org,
 "Guilherme G. Piccoli" <gpiccoli@...lia.com>,
 Joel Fernandes <joel@...lfernandes.org>, Kees Cook <keescook@...omium.org>,
 Tony Luck <tony.luck@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Günter Röck
 <groeck@...omium.org>, Sai Prakash Ranjan
 <saiprakash.ranjan@...eaurora.org>, Kunwu Chan <chentao@...inos.cn>
Subject: [PATCH] pstore/ram: Return directly after a failed kasprintf() call
 in ramoops_init_prz()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 17 Jan 2024 21:09:22 +0100

The result from a call of the function “kasprintf” was passed to
a subsequent function call without checking for a null pointer before
(according to a memory allocation failure).
This issue was detected by using the Coccinelle software.

Thus return directly after a failed kasprintf() call.

Fixes: 1227daa43bce1 ("pstore/ram: Clarify resource reservation labels")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/pstore/ram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 88b34fdbf759..1a673a4af17c 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -595,6 +595,9 @@ static int ramoops_init_prz(const char *name,
 	}

 	label = kasprintf(GFP_KERNEL, "ramoops:%s", name);
+	if (!label)
+		return -ENOMEM;
+
 	*prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info,
 				  cxt->memtype, PRZ_FLAG_ZAP_OLD, label);
 	kfree(label);
--
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ