* [PATCH net] rxrpc: Fix overread of short key descriptions
@ 2026-11-23 1:13 Lin Ma
2026-11-23 1:18 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Lin Ma @ 2026-11-23 1:13 UTC (permalink / raw)
To: David Howells, Marc Dionne; +Cc: netdev, linux-afs, linux-kernel, Lin Ma
rxrpc_read() checks whether the key description starts with "afs@" by
calling memcmp() with a length of 4. The description is an arbitrary
NUL-terminated string supplied when the key is created and is only
required to be non-empty, so it can be as short as one character. In
that case memcmp() reads up to two bytes past the end of the
kmemdup()'d description (which is strlen(description) + 1 bytes long).
The result of the comparison is not affected because the NUL terminator
is reached within the first four bytes, and the overread is normally
confined to the slab object, but it is still an out-of-bounds read.
Use str_has_prefix(), which stops at the NUL terminator.
Fixes: ed6dd18b5aceb ("RxRPC: Allow RxRPC keys to be read")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
net/rxrpc/key.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
index cbd26da44951..019e512aeb1f 100644
--- a/net/rxrpc/key.c
+++ b/net/rxrpc/key.c
@@ -746,7 +746,7 @@ static long rxrpc_read(const struct key *key,
_enter("");
/* we don't know what form we should return non-AFS keys in */
- if (memcmp(key->description, "afs@", 4) != 0)
+ if (!str_has_prefix(key->description, "afs@"))
return -EOPNOTSUPP;
cnlen = strlen(key->description + 4);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] rxrpc: Fix overread of short key descriptions
2026-11-23 1:13 [PATCH net] rxrpc: Fix overread of short key descriptions Lin Ma
@ 2026-11-23 1:18 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-23 1:18 UTC (permalink / raw)
To: Lin Ma; +Cc: David Howells, Marc Dionne, netdev, linux-afs, linux-kernel
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 1:13 [PATCH net] rxrpc: Fix overread of short key descriptions Lin Ma
2026-11-23 1:18 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox