[PATCH 1/3] afs: Fix ignored callbacks over ipv4
Marc Dionne
marc.dionne at auristor.com
Fri Feb 16 11:37:12 PST 2024
When searching for a matching peer, look in fs_addresses4 list rather
than the fs_addresses6 list if the peer address is v4.
When processing an incoming callback from an ipv4 address, this would
lead to a failure to set call->server, resulting in the callback being
ignored and the client seeing stale contents.
Fixes: 72904d7b9bfb ("rxrpc, afs: Allow afs to pin rxrpc_peer objects")
Reported-by: Markus Suvanto <markus.suvanto at gmail.com>
Link: https://lists.infradead.org/pipermail/linux-afs/2024-February/008035.html
Signed-off-by: Marc Dionne <marc.dionne at auristor.com>
---
fs/afs/server.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/fs/afs/server.c b/fs/afs/server.c
index e169121f603e..ff79d1761a84 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -38,12 +38,22 @@ struct afs_server *afs_find_server(struct afs_net *net, const struct rxrpc_peer
seq++; /* 2 on the 1st/lockless path, otherwise odd */
read_seqbegin_or_lock(&net->fs_addr_lock, &seq);
- hlist_for_each_entry_rcu(server, &net->fs_addresses6, addr6_link) {
- estate = rcu_dereference(server->endpoint_state);
- alist = estate->addresses;
- for (i = 0; i < alist->nr_addrs; i++)
- if (alist->addrs[i].peer == peer)
- goto found;
+ if (peer->src->transport.family == AF_INET6) {
+ hlist_for_each_entry_rcu(server, &net->fs_addresses6, addr6_link) {
+ estate = rcu_dereference(server->endpoint_state);
+ alist = estate->addresses;
+ for (i = 0; i < alist->nr_addrs; i++)
+ if (alist->addrs[i].peer == peer)
+ goto found;
+ }
+ } else {
+ hlist_for_each_entry_rcu(server, &net->fs_addresses4, addr4_link) {
+ estate = rcu_dereference(server->endpoint_state);
+ alist = estate->addresses;
+ for (i = 0; i < alist->nr_addrs; i++)
+ if (alist->addrs[i].peer == peer)
+ goto found;
+ }
}
server = NULL;
--
2.43.0
More information about the linux-afs
mailing list