From: Benjamin Coddington <[email protected]>

Don't bail out before cleaning up a new allocation if the wait for
searching for a matching nfs client is interrupted.  Memory leaks.

Reported-by: [email protected]
Fixes: 950a578c6128 ("NFS: make nfs_match_client killable")
Signed-off-by: Benjamin Coddington <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>

https://jira.sw.ru/browse/PSBM-98297
(cherry picked from commit 9f7761cf0409465075dadb875d5d4b8ef2f890c8)
Signed-off-by: Andrey Ryabinin <[email protected]>
---
 fs/nfs/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 0ba3b222bde5..09e6b85ab8fc 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -429,10 +429,10 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
                clp = nfs_match_client(cl_init);
                if (clp) {
                        spin_unlock(&nn->nfs_client_lock);
-                       if (IS_ERR(clp))
-                               return clp;
                        if (new)
                                new->rpc_ops->free_client(new);
+                       if (IS_ERR(clp))
+                               return clp;
                        return nfs_found_client(cl_init, clp);
                }
                if (new) {
-- 
2.21.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to