From: J. Bruce Fields Date: Mon, 23 Mar 2015 15:02:30 +0000 (-0400) Subject: nfsd: return correct lockowner when there is a race on hash insert X-Git-Tag: v3.19.5~65 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=083b5ebbae9370a00fe79e2b16c94d1e892b5765;p=linux nfsd: return correct lockowner when there is a race on hash insert commit 340f0ba1c6c8412aa35fd6476044836b84361ea6 upstream. alloc_init_lock_stateowner can return an already freed entry if there is a race to put openowners in the hashtable. Noticed by inspection after Jeff Layton fixed the same bug for open owners. Depending on client behavior, this one may be trickier to trigger in practice. Fixes: c58c6610ec24 "nfsd: Protect adding/removing lock owners using client_lock" Cc: Trond Myklebust Acked-by: Jeff Layton Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6488fd5d0437..7cfb905a1e90 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5065,7 +5065,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp, } else nfs4_free_lockowner(&lo->lo_owner); spin_unlock(&clp->cl_lock); - return lo; + return ret; } static void