]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - fs/nfsd/nfs4state.c
nfsd4: fix unlikely race in session replay case
[linux-imx.git] / fs / nfsd / nfs4state.c
index bba9fff49cfea532ceb03841ffb281b25c7c4e09..737315c61e7e0b77a6d18e605e0e0b006d869a18 100644 (file)
@@ -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) {