nfsd: return correct lockowner when there is a race on hash insert
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 23 Mar 2015 15:02:30 +0000 (11:02 -0400)
committerSasha Levin <sasha.levin@oracle.com>
Thu, 23 Apr 2015 18:58:27 +0000 (14:58 -0400)
commit604696d8b5d9ebf2f5af9bf46ac76519b831435f
tree4da80336929e02d5749bf7912b3e9bd6d749a46b
parent5a472b11c0afd6457e4f4222083efa1536562496
nfsd: return correct lockowner when there is a race on hash insert

[ Upstream commit 340f0ba1c6c8412aa35fd6476044836b84361ea6 ]

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: <stable@vger.kernel.org>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Acked-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/nfsd/nfs4state.c