From: Pei Xiao <xiaopei01@kylinos.cn>
To: jarkko@kernel.org, peterhuewe@gmx.de,
linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pei Xiao <xiaopei01@kylinos.cn>
Subject: [PATCH v2 0/4] tpm: some tpm small fixes.
Date: Thu, 8 Oct 2026 09:16:19 +0800 [thread overview]
Message-ID: <cover.1791421672.git.xiaopei01@kylinos.cn> (raw)
This series fixes several small issues found during a code review of
drivers/char/tpm:
1. tpm_ppi: tpm_show_ppi_response() stores its return value in an
acpi_status (a u32 typedef), so error codes such as -EINVAL reach
user space as huge positive values. Declare the variable as
ssize_t to match the show callback's return type.
2. tpm_nsc: tpm_nsc_remove() doubles as the release callback of the
hand-created platform device and dereferences the chip drvdata
unconditionally; init failures before tpmm_chip_alloc() crash
module load. Return early when the chip has not been created.
3. tpm_nsc: the cleanup runs twice on module exit because
tpm_nsc_remove() is both the explicit cleanup and the device
release callback; the second run operates on an already freed
chip. Stop overriding the release callback, which also stops the
platform object allocation from leaking.
4. tpm_dev: a zero-length read() discards a pending response,
breaking the command/response pairing of the TPM character
devices, although POSIX requires zero-count reads to have no side
effects. Return early on a zero count.
chhanges in v2:
1.add reviewed-by tag
2.remove patch 5:
make the tpm_init() error messages consistently prefixed with "tpm: " and
report the actual failure of tpm_dev_common_init().
3.modify patch 1 git commit information.
Pei Xiao (4):
tpm: tpm_ppi: fix zero-extension of negative error codes
tpm: tpm_nsc: fix NULL pointer dereference on init failure
tpm: tpm_nsc: stop using the cleanup callback as dev.release
tpm: fix zero-length read discarding the pending response
drivers/char/tpm/tpm-dev-common.c | 3 +++
drivers/char/tpm/tpm_nsc.c | 8 ++++++--
drivers/char/tpm/tpm_ppi.c | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
--
2.25.1
next reply other threads:[~2026-10-08 1:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 1:16 Pei Xiao [this message]
2026-10-08 1:16 ` [PATCH v2 1/4] tpm: tpm_ppi: fix zero-extension of negative error codes Pei Xiao
2026-10-08 17:49 ` Jarkko Sakkinen
2026-10-08 1:16 ` [PATCH v2 2/4] tpm: tpm_nsc: fix NULL pointer dereference on init failure Pei Xiao
2026-10-08 1:16 ` [PATCH v2 3/4] tpm: tpm_nsc: stop using the cleanup callback as dev.release Pei Xiao
2026-10-08 1:16 ` [PATCH v2 4/4] tpm: fix zero-length read discarding the pending response Pei Xiao
2026-10-08 17:51 ` [PATCH v2 0/4] tpm: some tpm small fixes Jarkko Sakkinen
2026-10-09 1:01 ` Pei Xiao
2026-10-10 4:37 ` Jarkko Sakkinen
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=cover.1791421672.git.xiaopei01@kylinos.cn \
--to=xiaopei01@kylinos.cn \
--cc=jarkko@kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.