From: Bilal Hashim <AeeSec@126.com>
To: David Howells <dhowells@redhat.com>,
Marc Dionne <marc.dionne@auristor.com>
Cc: linux-afs@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Bilal Hashim <AeeSec@126.com>
Subject: [PATCH] rxrpc: rxgk: round up appdata and authx lengths in rxgk_construct_response()
Date: Fri, 27 Nov 2026 20:52:50 +0800 [thread overview]
Message-ID: <20261127125250.1434-1-AeeSec@126.com> (raw)
In rxgk_construct_response(), the buffer length calculation forgets to
round up both `appdata->len` and `authx_len` to 4-byte XDR boundaries:
1. `auth_len` is computed using `appdata->len` instead of
`xdr_round_up(appdata->len)`, while rxgk_construct_authenticator()
pads `appdata` to `xdr_round_up(appdata->len)` bytes and returns
`sizeof(a) + xdr_round_up(appdata->len) + sizeof(b)`. When userspace
supplies a non-4-byte-aligned `RXRPC_RESP_RXGK_APPDATA` control
message, the allocated authenticator buffer is up to 3 bytes too
short, causing `skb_store_bits()` / `crypto_krb5_encrypt()` to fail
or hit `WARN_ON()` in `crypto_krb5_encrypt()`.
2. `len` uses `(4 + authx_len)` instead of `(4 + xdr_round_up(authx_len))`,
even though `rxgk_pad_out()` subsequently writes up to 3 trailing XDR
padding bytes after `authx_offset + authx_len`.
Wrap both `appdata->len` and `authx_len` in `xdr_round_up()`.
Signed-off-by: Bilal Hashim <AeeSec@126.com>
---
--- a/net/rxrpc/rxgk.c
+++ b/net/rxrpc/rxgk.c
@@ -936,11 +936,12 @@ static int rxgk_construct_response(struct rxrpc_connection *conn,
if (IS_ERR(gk))
return PTR_ERR(gk);
- auth_len = 20 + (4 + appdata->len) + 12 + (1 + 4) * 4;
+ auth_len = 20 + (4 + xdr_round_up(appdata->len)) + 12 + (1 + 4) * 4;
authx_len = crypto_krb5_how_much_buffer(gk->krb5, KRB5_ENCRYPT_MODE,
auth_len, &auth_offset);
len = sizeof(struct rxrpc_wire_header) +
- 8 + (4 + xdr_round_up(gk->key->ticket.len)) + (4 + authx_len);
+ 8 + (4 + xdr_round_up(gk->key->ticket.len)) +
+ (4 + xdr_round_up(authx_len));
response = alloc_skb_with_frags(0, len, 0, &ret, GFP_NOFS);
if (!response)
next reply other threads:[~2026-11-27 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 12:52 Bilal Hashim [this message]
2026-11-27 12:58 ` netdev-bot+sinfo
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=20261127125250.1434-1-AeeSec@126.com \
--to=aeesec@126.com \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=netdev@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®