Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 340f0ba1 authored by J. Bruce Fields's avatar J. Bruce Fields
Browse files

nfsd: return correct lockowner when there is a race on hash insert



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: c58c6610 "nfsd: Protect adding/removing lock owners using client_lock"
Cc: <stable@vger.kernel.org>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Acked-by: default avatarJeff Layton <jeff.layton@primarydata.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent c5952338
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -5062,7 +5062,7 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp,
	} else
	} else
		nfs4_free_lockowner(&lo->lo_owner);
		nfs4_free_lockowner(&lo->lo_owner);
	spin_unlock(&clp->cl_lock);
	spin_unlock(&clp->cl_lock);
	return lo;
	return ret;
}
}


static void
static void