diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2010-04-24 15:35:43 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2010-05-03 08:32:31 -0400 |
commit | 26c0c75e69265961e891ed80b38fb62a548ab371 (patch) | |
tree | 1ecbc767a1b2ad3e8f25d88e918076806d8c2eb1 /fs/nfsd/nfs4state.c | |
parent | e0c8233622cbd49d171bc57b60e725f2fb748750 (diff) | |
download | kernel_samsung_smdk4412-26c0c75e69265961e891ed80b38fb62a548ab371.zip kernel_samsung_smdk4412-26c0c75e69265961e891ed80b38fb62a548ab371.tar.gz kernel_samsung_smdk4412-26c0c75e69265961e891ed80b38fb62a548ab371.tar.bz2 |
nfsd4: fix unlikely race in session replay case
In the replay case, the
renew_client(session->se_client);
happens after we've droppped the sessionid_lock, and without holding a
reference on the session; so there's nothing preventing the session
being freed before we get here.
Thanks to Benny Halevy for catching a bug in an earlier version of this
patch.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Acked-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index bba9fff..737315c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1443,11 +1443,10 @@ nfsd4_sequence(struct svc_rqst *rqstp, cstate->slot = slot; cstate->session = session; - /* Hold a session reference until done processing the compound: - * nfsd4_put_session called only if the cstate slot is set. - */ - nfsd4_get_session(session); out: + /* Hold a session reference until done processing the compound. */ + if (cstate->session) + nfsd4_get_session(cstate->session); spin_unlock(&sessionid_lock); /* Renew the clientid on success and on replay */ if (cstate->session) { |