diff options
| author | Pei Xiao <xiaopei01@kylinos.cn> | 2026-10-03 16:27:54 +0800 |
|---|---|---|
| committer | Jarkko Sakkinen <jarkko@kernel.org> | 2026-10-23 00:59:20 +0300 |
| commit | 6fc1b05077b8ac7c3193616f0bc419f6185988c6 (patch) | |
| tree | f8c2429d53aa9109687bc79b48c6c38126fbbfa2 /tools/perf/scripts/python/bin/task-analyzer-report | |
| parent | df0ef271087623439a1e900f323ed2a57204706d (diff) | |
tpm: fix zero-length read discarding the pending response
POSIX requires that a read() with a count of zero returns zero and
has no other effects. tpm_common_read() treats such a call as a
consumed response: it marks the pending response as read and drops
it, so the response can never be retrieved; subsequent reads return
zero and the next write() is allowed to overwrite the response
buffer, silently breaking the command/response pairing of the TPM
character devices.
Return early when the caller passes a zero count, leaving any
pending response untouched for the next read. A zero-length read
will not report a deferred asynchronous error; POSIX permits read()
to skip error detection for a zero count.
Cc: stable@vger.kernel.org
Fixes: 9488585b21be ("tpm: add support for partial reads")
Assisted-by: GLM-5.3
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Link: https://lore.kernel.org/r/3f15140ab3c26e98b49d6aceaaa826585d56960b.1791015549.git.xiaopei01@kylinos.cn
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/task-analyzer-report')
0 files changed, 0 insertions, 0 deletions
