Skip to content

Commit

Permalink
nfsd: Fix a file leak on nfsd4_layout_setlease failure
Browse files Browse the repository at this point in the history
If nfsd4_layout_setlease fails, nfsd will not put ls->ls_file.

Fix commit c5c707f "nfsd: implement pNFS layout recalls".

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
kinglongmee authored and J. Bruce Fields committed Jul 20, 2015
1 parent c2227a3 commit 1ca4b88
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/nfsd/nfs4layouts.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate,
BUG_ON(!ls->ls_file);

if (nfsd4_layout_setlease(ls)) {
fput(ls->ls_file);
put_nfs4_file(fp);
kmem_cache_free(nfs4_layout_stateid_cache, ls);
return NULL;
Expand Down

0 comments on commit 1ca4b88

Please sign in to comment.