NFS: Fix a double unlock from nfs_match,get_client
authorBenjamin Coddington <bcodding@redhat.com>
Thu, 9 May 2019 11:25:21 +0000 (07:25 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 9 May 2019 20:26:57 +0000 (16:26 -0400)
Now that nfs_match_client drops the nfs_client_lock, we should be
careful
to always return it in the same condition: locked.

Fixes: 950a578c6128 ("NFS: make nfs_match_client killable")
Reported-by: syzbot+228a82b263b5da91883d@syzkaller.appspotmail.com
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/client.c

index 06e8719655f0b08e98abcc87da32c45d71a7f22b..da74c4c4a244cfd7ecd585f2b8a9e03e4c4b846c 100644 (file)
@@ -299,9 +299,9 @@ again:
                        spin_unlock(&nn->nfs_client_lock);
                        error = nfs_wait_client_init_complete(clp);
                        nfs_put_client(clp);
+                       spin_lock(&nn->nfs_client_lock);
                        if (error < 0)
                                return ERR_PTR(error);
-                       spin_lock(&nn->nfs_client_lock);
                        goto again;
                }