]> git.hungrycats.org Git - linux/commitdiff
nfsd4: Fix filp leak
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Mon, 18 Apr 2011 15:48:55 +0000 (11:48 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 May 2011 16:19:34 +0000 (09:19 -0700)
commit a96e5b90804be8b540d30f4a1453fc87f95b3149 upstream.

23fcf2ec93fb8573a653408316af599939ff9a8e (nfsd4: fix oops on lock failure)

The above patch breaks free path for stp->st_file. If stp was inserted
into sop->so_stateids, we have to free stp->st_file refcount. Because
stp->st_file refcount itself is taken whether or not any refcounts are
taken on the stp->st_file->fi_fds[].

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfsd/nfs4state.c

index 201915af6864dff517c75efb97f446b4251f53f0..18c356cd50d8a52f3b99af7cbf43d8bed7504552 100644 (file)
@@ -403,8 +403,8 @@ static void free_generic_stateid(struct nfs4_stateid *stp)
        if (stp->st_access_bmap) {
                oflag = nfs4_access_bmap_to_omode(stp);
                nfs4_file_put_access(stp->st_file, oflag);
-               put_nfs4_file(stp->st_file);
        }
+       put_nfs4_file(stp->st_file);
        kmem_cache_free(stateid_slab, stp);
 }