Skip to content

Commit 9c07b75

Browse files
author
Trond Myklebust
committed
NFS: Fix a race in __nfs_list_for_each_server()
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: 3c9e502 ("NFS: Add a helper nfs_client_for_each_server()") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 8e2912c commit 9c07b75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int __nfs_list_for_each_server(struct list_head *head,
185185

186186
rcu_read_lock();
187187
list_for_each_entry_rcu(server, head, client_link) {
188-
if (!nfs_sb_active(server->super))
188+
if (!(server->super && nfs_sb_active(server->super)))
189189
continue;
190190
rcu_read_unlock();
191191
if (last)

0 commit comments

Comments
 (0)