nfsd: fix potential lease memory leak in nfs4_setlease
authorJeff Layton <jlayton@primarydata.com>
Fri, 22 Aug 2014 16:26:36 +0000 (12:26 -0400)
committerJeff Layton <jlayton@primarydata.com>
Tue, 9 Sep 2014 20:01:36 +0000 (16:01 -0400)
commitf6d668e88ffc068bfd4a0a798864689d5803c7c2
tree4f5bf79ab82a33602956077c20a6a5df61c011ba
parent670a783c909b747c55506cf5fdcf18b90631aae0
nfsd: fix potential lease memory leak in nfs4_setlease

It's unlikely to ever occur, but if there were already a lease set on
the file then we could end up getting back a different pointer on a
successful setlease attempt than the one we allocated. If that happens,
the one we allocated could leak.

In practice, I don't think this will happen due to the fact that we only
try to set up the lease once per nfs4_file, but this error handling is a
bit more correct given the current lease API.

Cc: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/nfsd/nfs4state.c