mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: dell-wmi-sysman: fix heap OOB when scanning for a newline
@ 2026-11-18  7:22 Hyunjung Ko
  0 siblings, 0 replies; only message in thread
From: Hyunjung Ko @ 2026-11-18  7:22 UTC (permalink / raw)
  To: Prasanth Ksr, Hans de Goede, Ilpo Järvinen
  Cc: Dell.Client.Kernel, platform-driver-x86, linux-kernel, stable,
	Hyunjung Ko

The current_value and new_password store handlers copy the input with
kstrdup(), which stops at the first NUL, and then search the copy for a
newline with memchr() over the full write size. If the written data
contains an embedded NUL, memchr() reads past the end of the copy, and
a newline found there is overwritten with a NUL byte.

The copy is NUL-terminated, so use strchr() instead.

This is the same issue that was fixed in hp-bioscfg by commit
ea146aaac690 ("platform/x86: hp-bioscfg: fix heap OOB in
hp_enforce_single_line_input()").

Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
---
 drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h    | 2 +-
 drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h b/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
index eb48ced55823..808ff9e70add 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/dell-wmi-sysman.h
@@ -144,7 +144,7 @@ static ssize_t curr_val##_store(struct kobject *kobj,				\
 	buf_cp = kstrdup(buf, GFP_KERNEL);					\
 	if (!buf_cp)								\
 		return -ENOMEM;							\
-	p = memchr(buf_cp, '\n', count);					\
+	p = strchr(buf_cp, '\n');						\
 										\
 	if (p != NULL)								\
 		*p = '\0';							\
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
index be939b731063..9677811436bc 100644
--- a/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
+++ b/drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c
@@ -79,7 +79,7 @@ static ssize_t new_password_store(struct kobject *kobj,
 	buf_cp = kstrdup(buf, GFP_KERNEL);
 	if (!buf_cp)
 		return -ENOMEM;
-	p = memchr(buf_cp, '\n', count);
+	p = strchr(buf_cp, '\n');
 
 	if (p != NULL)
 		*p = '\0';
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-18  7:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18  7:22 [PATCH] platform/x86: dell-wmi-sysman: fix heap OOB when scanning for a newline Hyunjung Ko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®