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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241128024026.21213-1-hanchunchao@inspur.com>
Date: Thu, 28 Nov 2024 10:40:26 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <myungjoo.ham@...sung.com>, <cw00.choi@...sung.com>,
	<stanley_chang@...ltek.com>
CC: <linux-kernel@...r.kernel.org>, Charles Han <hanchunchao@...pur.com>
Subject: [PATCH] extcon: realtek: Add NULL pointer check in extcon_rtk_type_c_probe

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

Fixes: 8a590d7371f0 ("extcon: add Realtek DHC RTD SoC Type-C driver")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
 drivers/extcon/extcon-rtk-type-c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/extcon/extcon-rtk-type-c.c b/drivers/extcon/extcon-rtk-type-c.c
index 19a01e663733..2820c7e82481 100644
--- a/drivers/extcon/extcon-rtk-type-c.c
+++ b/drivers/extcon/extcon-rtk-type-c.c
@@ -1369,6 +1369,8 @@ static int extcon_rtk_type_c_probe(struct platform_device *pdev)
 	}
 
 	type_c->type_c_cfg = devm_kzalloc(dev, sizeof(*type_c_cfg), GFP_KERNEL);
+	if (!type_c->type_c_cfg)
+		return -ENOMEM;
 
 	memcpy(type_c->type_c_cfg, type_c_cfg, sizeof(*type_c_cfg));
 
-- 
2.31.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ