afs: Fix the setting of the server responding flag
authorDavid Howells <dhowells@redhat.com>
Mon, 23 Sep 2024 15:07:50 +0000 (16:07 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 27 Sep 2024 16:29:20 +0000 (18:29 +0200)
In afs_wait_for_operation(), we set transcribe the call responded flag to
the server record that we used after doing the fileserver iteration loop -
but it's possible to exit the loop having had a response from the server
that we've discarded (e.g. it returned an abort or we started receiving
data, but the call didn't complete).

This means that op->server might be NULL, but we don't check that before
attempting to set the server flag.

Fixes: 98f9fda2057b ("afs: Fold the afs_addr_cursor struct in")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20240923150756.902363-7-dhowells@redhat.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/afs/fs_operation.c

index 3546b087e791d49555fb6566246a1bacba781d70..428721bbe4f6e377726ba75e2478732a1487205d 100644 (file)
@@ -201,7 +201,7 @@ void afs_wait_for_operation(struct afs_operation *op)
                }
        }
 
-       if (op->call_responded)
+       if (op->call_responded && op->server)
                set_bit(AFS_SERVER_FL_RESPONDING, &op->server->flags);
 
        if (!afs_op_error(op)) {