Skip to contentSkip to conversation

rxrpc: rxgk: Initialize challenge control message

PATCH In review Weiming Shi 2 participants 2 messages Sep 18 – Sep 21

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rxrpc: rxgk: Initialize challenge control message

rxgk_challenge_to_recvmsg() copies the complete rxgk_challenge structure into an RXRPC_CHALLENGED control message. The pad member of the embedded rxrpc_challenge is not assigned, so the copy can disclose one byte of kernel stack memory to userspace.

Initialize the whole structure before filling its meaningful fields so that the reserved byte is always zero.

Fixes 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Assisted-by LLM
---
 net/rxrpc/rxgk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/rxgk.c +1 -1
index 77a67ace1d248..799772b0d8472 100644
@@ -756,7 +756,7 @@ static int rxgk_challenge_to_recvmsg(struct rxrpc_connection *conn,
 				     struct sk_buff *challenge,
 				     struct msghdr *msg)
 {
-	struct rxgk_challenge chall;
+	struct rxgk_challenge chall = {};
 
 	chall.base.service_id		= conn->service_id;
 	chall.base.security_index	= conn->security_ix;
Signature · 1 line
2.55.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Weiming Shi

rxgk_challenge_to_recvmsg() copies the complete rxgk_challenge structure into an RXRPC_CHALLENGED control message. The pad member of the embedded rxrpc_challenge is not assigned, so the copy can disclose one byte of kernel stack memory to userspace.

Quoted 8 lines

Initialize the whole structure before filling its meaningful fields so that the reserved byte is always zero.

Fixes 9d1d2b59341f ("rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)")
Assisted-by LLM

...