From: Hyunjung Ko <hj351016@gmail.com>
To: "Prasanth Ksr" <prasanth.ksr@dell.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Hyunjung Ko <hj351016@gmail.com>
Subject: [PATCH] platform/x86: dell-wmi-sysman: fix heap OOB when scanning for a newline
Date: Wed, 18 Nov 2026 16:22:53 +0900 [thread overview]
Message-ID: <20261118072253.896390-1-hj351016@gmail.com> (raw)
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
reply other threads:[~2026-11-18 7:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118072253.896390-1-hj351016@gmail.com \
--to=hj351016@gmail.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=prasanth.ksr@dell.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®