From: Benjamin Coddington Date: Tue, 11 Jun 2019 16:57:52 +0000 (-0400) Subject: NFS: Cleanup if nfs_match_client is interrupted X-Git-Tag: microblaze-v5.4-rc1~242^2~22 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=9f7761cf0409465075dadb875d5d4b8ef2f890c8;p=linux-2.6-microblaze.git NFS: Cleanup if nfs_match_client is interrupted 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: syzbot+7fe11b49c1cc30e3fce2@syzkaller.appspotmail.com Fixes: 950a578c6128 ("NFS: make nfs_match_client killable") Signed-off-by: Benjamin Coddington Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/client.c b/fs/nfs/client.c index e4fa0a5fd183..30838304a0bf 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -408,10 +408,10 @@ struct nfs_client *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) {