This is a note to let you know that I've just added the patch titled NFS: Fix a race in __nfs_list_for_each_server() to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfs-fix-a-race-in-__nfs_list_for_each_server.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9c07b75b80eeff714420fb6a4c880b284e529d0f Mon Sep 17 00:00:00 2001 From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Date: Thu, 30 Apr 2020 15:08:26 -0400 Subject: NFS: Fix a race in __nfs_list_for_each_server() From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> commit 9c07b75b80eeff714420fb6a4c880b284e529d0f upstream. The struct nfs_server gets put on the cl_superblocks list before the server->super field has been initialised, in which case the call to nfs_sb_active() will Oops. Add a check to ensure that we skip such a list entry. Fixes: 3c9e502b59fb ("NFS: Add a helper nfs_client_for_each_server()") Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -445,7 +445,7 @@ static int __nfs_list_for_each_server(st rcu_read_lock(); list_for_each_entry_rcu(server, head, client_link) { - if (!nfs_sb_active(server->super)) + if (!(server->super && nfs_sb_active(server->super))) continue; rcu_read_unlock(); if (last) Patches currently in stable-queue which might be from trond.myklebust@xxxxxxxxxxxxxxx are queue-5.4/nfs4-trace-state-recovery-operation.patch queue-5.4/nfsv4-fix-a-nfs4_state_manager-race.patch queue-5.4/sunrpc-mark-the-cred-for-revalidation-if-the-server-.patch queue-5.4/nfs-fix-a-race-in-__nfs_list_for_each_server.patch queue-5.4/nfs-add-a-helper-nfs_client_for_each_server.patch queue-5.4/nfs-pnfs-report-einval-errors-from-connect-to-the-se.patch