linux/net/rxrpc
David Howells 020c69c1a7 rxrpc: Truncate UTS_RELEASE for rxrpc version
UTS_RELEASE has a maximum length of 64 which can cause rxrpc_version to
exceed the 65 byte message limit.

Per the rx spec[1]: "If a server receives a packet with a type value of 13,
and the client-initiated flag set, it should respond with a 65-byte payload
containing a string that identifies the version of AFS software it is
running."

The current implementation causes a compile error when WERROR is turned on
and/or UTS_RELEASE exceeds the length of 49 (making the version string more
than 64 characters).

Fix this by generating the string during module initialisation and limiting
the UTS_RELEASE segment of the string does not exceed 49 chars.  We need to
make sure that the 64 bytes includes "linux-" at the front and " AF_RXRPC"
at the back as this may be used in pattern matching.

Fixes: 44ba06987c ("RxRPC: Handle VERSION Rx protocol packets")
Reported-by: Kenny Ho <Kenny.Ho@amd.com>
Link: https://lore.kernel.org/r/20230523223944.691076-1-Kenny.Ho@amd.com/
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Kenny Ho <Kenny.Ho@amd.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Andrew Lunn <andrew@lunn.ch>
cc: David Laight <David.Laight@ACULAB.COM>
cc: "David S. Miller" <davem@davemloft.net>
cc: Eric Dumazet <edumazet@google.com>
cc: Jakub Kicinski <kuba@kernel.org>
cc: Paolo Abeni <pabeni@redhat.com>
cc: linux-afs@lists.infradead.org
cc: netdev@vger.kernel.org
Link: https://web.mit.edu/kolya/afs/rx/rx-spec [1]
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Link: https://lore.kernel.org/r/654974.1685100894@warthog.procyon.org.uk
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2023-05-30 10:01:06 +02:00
..
af_rxrpc.c rxrpc: Truncate UTS_RELEASE for rxrpc version 2023-05-30 10:01:06 +02:00
ar-internal.h rxrpc: Truncate UTS_RELEASE for rxrpc version 2023-05-30 10:01:06 +02:00
call_accept.c rxrpc: Fix trace string 2023-01-30 14:13:29 +00:00
call_event.c rxrpc: De-atomic call->ackr_window and call->ackr_nr_unacked 2023-01-31 16:38:26 +00:00
call_object.c Including fixes from netfilter. 2023-05-05 19:12:01 -07:00
call_state.c rxrpc: Move client call connection to the I/O thread 2023-01-06 09:43:33 +00:00
conn_client.c rxrpc: Move client call connection to the I/O thread 2023-01-06 09:43:33 +00:00
conn_event.c rxrpc: Trace ack.rwind 2023-02-07 23:11:21 +00:00
conn_object.c rxrpc: Move client call connection to the I/O thread 2023-01-06 09:43:33 +00:00
conn_service.c rxrpc: Kill service bundle 2023-01-31 16:38:35 +00:00
input.c rxrpc: Fix overproduction of wakeups to recvmsg() 2023-02-20 08:33:25 +01:00
insecure.c rxrpc: Tidy up abort generation infrastructure 2023-01-06 09:43:32 +00:00
io_thread.c rxrpc: Allow a delay to be injected into packet reception 2023-01-31 16:38:09 +00:00
Kconfig rxrpc: Allow a delay to be injected into packet reception 2023-01-31 16:38:09 +00:00
key.c rxrpc: Fix error when reading rxrpc tokens 2023-04-23 13:38:28 +01:00
local_event.c rxrpc: Truncate UTS_RELEASE for rxrpc version 2023-05-30 10:01:06 +02:00
local_object.c rxrpc: Remove local->defrag_sem 2023-01-31 16:38:35 +00:00
Makefile rxrpc: Split out the call state changing functions into their own file 2023-01-06 09:43:32 +00:00
misc.c rxrpc: Allow a delay to be injected into packet reception 2023-01-31 16:38:09 +00:00
net_ns.c rxrpc: Move the client conn cache management to the I/O thread 2023-01-06 09:43:33 +00:00
output.c rxrpc: Trace ack.rwind 2023-02-07 23:11:21 +00:00
peer_event.c rxrpc: Fix locking issues in rxrpc_put_peer_locked() 2022-12-19 09:51:31 +00:00
peer_object.c rxrpc: Stash the network namespace pointer in rxrpc_local 2023-01-06 09:43:31 +00:00
proc.c rxrpc: De-atomic call->ackr_window and call->ackr_nr_unacked 2023-01-31 16:38:26 +00:00
protocol.h rxrpc: Replace fake flex-array with flexible-array member 2023-04-23 13:36:05 +01:00
recvmsg.c rxrpc: Fix overproduction of wakeups to recvmsg() 2023-02-20 08:33:25 +01:00
rtt.c rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies() 2021-09-24 14:18:34 +01:00
rxkad.c rxrpc: Move client call connection to the I/O thread 2023-01-06 09:43:33 +00:00
rxperf.c rxrpc: Fix potential race in error handling in afs_make_call() 2023-04-22 15:16:39 +01:00
security.c rxrpc: Fix incoming call setup race 2023-01-07 09:30:26 +00:00
sendmsg.c rxrpc: Fix timeout of a call that hasn't yet been granted a channel 2023-05-01 07:43:19 +01:00
server_key.c rxrpc: Implement an in-kernel rxperf server for testing purposes 2022-12-01 13:36:37 +00:00
skbuff.c rxrpc: Use consume_skb() rather than kfree_skb_reason() 2023-02-07 23:11:20 +00:00
sysctl.c rxrpc: Allow a delay to be injected into packet reception 2023-01-31 16:38:09 +00:00
txbuf.c rxrpc: Don't lock call->tx_lock to access call->tx_buffer 2023-01-31 16:38:35 +00:00
utils.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00