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: <20250410105256.70310-1-hanchunchao@inspur.com>
Date: Thu, 10 Apr 2025 18:52:53 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <arnd@...db.de>, <gregkh@...uxfoundation.org>, <jpanis@...libre.com>
CC: <linux-kernel@...r.kernel.org>, Charles Han <hanchunchao@...pur.com>
Subject: [PATCH] misc: tps6594-pfsm: Add NULL check in tps6594_pfsm_probe

devm_kasprintf() can return a NULL pointer on failure,but this
returned value in tps6594_pfsm_probe() is not checked.
Add NULL check in tps6594_pfsm_probe(), to handle kernel NULL
pointer dereference error.

Fixes: a0df3ef087f8 ("misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
 drivers/misc/tps6594-pfsm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/tps6594-pfsm.c b/drivers/misc/tps6594-pfsm.c
index 0a24ce44cc37..05c4e081a8d2 100644
--- a/drivers/misc/tps6594-pfsm.c
+++ b/drivers/misc/tps6594-pfsm.c
@@ -281,6 +281,11 @@ static int tps6594_pfsm_probe(struct platform_device *pdev)
 	pfsm->miscdev.minor = MISC_DYNAMIC_MINOR;
 	pfsm->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "pfsm-%ld-0x%02x",
 					    tps->chip_id, tps->reg);
+	if (!pfsm->miscdev.name) {
+		devm_kfree(dev, pfsm);
+		return -ENOMEM;
+	}
+
 	pfsm->miscdev.fops = &tps6594_pfsm_fops;
 	pfsm->miscdev.parent = dev->parent;
 	pfsm->chip_id = tps->chip_id;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ