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: <20250704025838.11810-1-jhb_ee@163.com>
Date: Fri,  4 Jul 2025 10:58:38 +0800
From: Hongbin Ji <jhb_ee@....com>
To: jogletre@...nsource.cirrus.com
Cc: fred.treven@...rus.com,
	ben.bright@...rus.com,
	dmitry.torokhov@...il.com,
	patches@...nsource.cirrus.com,
	linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Hongbin Ji <jhb_ee@....com>
Subject: [PATCH] Input: cs40l50 -  fix possible NULL pointer dereference

Add a NULL‐check and return ‑ENOMEM if allocation failed to prevent a kernel oops

Signed-off-by: Hongbin Ji <jhb_ee@....com>
---
 drivers/input/misc/cs40l50-vibra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/misc/cs40l50-vibra.c b/drivers/input/misc/cs40l50-vibra.c
index dce3b0ec8cf3..61d87bc5f175 100644
--- a/drivers/input/misc/cs40l50-vibra.c
+++ b/drivers/input/misc/cs40l50-vibra.c
@@ -238,6 +238,9 @@ static int cs40l50_upload_owt(struct cs40l50_work *work_data)
 	header.data_words = len / sizeof(u32);
 
 	new_owt_effect_data = kmalloc(sizeof(header) + len, GFP_KERNEL);
+	if (!new_owt_effect_data) {
+		return -ENOMEM;
+	}
 
 	memcpy(new_owt_effect_data, &header, sizeof(header));
 	memcpy(new_owt_effect_data + sizeof(header), work_data->custom_data, len);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ