From: Guo Zihao <guozh23@xiaopeng.com>
To: Jonathan Buzzard <jonathan@buzzard.org.uk>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH] char: toshiba: restrict the SMM device to root
Date: Fri, 6 Nov 2026 09:49:47 +0800 [thread overview]
Message-ID: <20261106014947.4128799-1-guozh23@xiaopeng.com> (raw)
The toshiba misc device is registered without a .mode member:
static struct miscdevice tosh_device = {
TOSH_MINOR_DEV,
"toshiba",
&tosh_fops
};
misc_devnode() only overrides the default when ->mode is non-zero, so
/dev/toshiba is created with the default 0666: every local user can
open it and issue TOSH_SMM ioctls.
tosh_ioctl() copies caller-supplied SMMRegisters into the CPU and
enters System Management Mode via inb $0xb2. The filter in front of
the call only rejects two HCI selectors (ax 0xff00/0xfe00 with
bx > 0x0069), so every other SMM entry point the BIOS offers, along
with caller-chosen register values, is reachable by unprivileged
userspace.
Give the misc device a mode of 0600 so the node is only usable by
root, which is what a ring -2 firmware interface should require.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Guo Zihao <guozh23@xiaopeng.com>
---
drivers/char/toshiba.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index 776abbfd8..bea2643ec 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -87,9 +87,10 @@ static const struct file_operations tosh_fops = {
};
static struct miscdevice tosh_device = {
- TOSH_MINOR_DEV,
- "toshiba",
- &tosh_fops
+ .minor = TOSH_MINOR_DEV,
+ .name = "toshiba",
+ .fops = &tosh_fops,
+ .mode = 0600,
};
/*
--
2.50.1
reply other threads:[~2026-11-06 1:49 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=20261106014947.4128799-1-guozh23@xiaopeng.com \
--to=guozh23@xiaopeng.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan@buzzard.org.uk \
--cc=linux-kernel@vger.kernel.org \
--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®