[PATCH 1/2] afs: Guard NULL alist on restart in afs_select_vlserver()

From: Elkin Cruz

Date: Wed Nov 25 2026 - 17:18:19 EST


In afs_select_vlserver(), restart_from_beginning: is reached from
no_more_servers: after pick_server:, where alist and vc->alist have
already been cleared to NULL at next_server:. If an earlier VL call
received a response (vc->call_responded == true) before failing with
-ECONNRESET (setting AFS_VL_CURSOR_RETRY), vc->call_responded remains
true until another server address is selected, causing
restart_from_beginning: to dereference a NULL vc->alist.

Guard the preferred-address update and afs_put_addrlist() at
restart_from_beginning: with if (alist), matching the failed: path.

Fixes: 98f9fda2057b ("afs: Fold the afs_addr_cursor struct in")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Elkin Cruz <elkin@xxxxxxxxxx>
---
fs/afs/vl_rotate.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/afs/vl_rotate.c b/fs/afs/vl_rotate.c
index 6ad9688d8f4b..8381d6a35d3e 100644
--- a/fs/afs/vl_rotate.c
+++ b/fs/afs/vl_rotate.c
@@ -171,12 +171,15 @@ bool afs_select_vlserver(struct afs_vl_cursor *vc)

restart_from_beginning:
_debug("restart");
- if (vc->call_responded &&
- vc->addr_index != vc->alist->preferred &&
- test_bit(alist->preferred, &vc->addr_tried))
- WRITE_ONCE(alist->preferred, vc->addr_index);
- afs_put_addrlist(alist, afs_alist_trace_put_vlrotate_restart);
- alist = vc->alist = NULL;
+ if (alist) {
+ if (vc->call_responded &&
+ vc->addr_index != alist->preferred &&
+ test_bit(alist->preferred, &vc->addr_tried))
+ WRITE_ONCE(alist->preferred, vc->addr_index);
+ afs_put_addrlist(alist, afs_alist_trace_put_vlrotate_restart);
+ vc->alist = NULL;
+ alist = NULL;
+ }

afs_put_vlserverlist(vc->cell->net, vc->server_list);
vc->server_list = NULL;
--
2.56.1.839.g22a8290db9-goog