Skip to content
Snippets Groups Projects
Commit 9c07b75b authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: 3c9e502b ("NFS: Add a helper nfs_client_for_each_server()")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 8e2912c7
No related branches found
No related tags found
No related merge requests found
...@@ -185,7 +185,7 @@ static int __nfs_list_for_each_server(struct list_head *head, ...@@ -185,7 +185,7 @@ static int __nfs_list_for_each_server(struct list_head *head,
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(server, head, client_link) { list_for_each_entry_rcu(server, head, client_link) {
if (!nfs_sb_active(server->super)) if (!(server->super && nfs_sb_active(server->super)))
continue; continue;
rcu_read_unlock(); rcu_read_unlock();
if (last) if (last)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment