Skip to content

Commit d8e8fbe

Browse files
committed
Merge tag 'nfsd-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: - Address three recently introduced regressions * tag 'nfsd-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: NFSD: CREATE_SESSION must never cache NFS4ERR_DELAY replies SUNRPC: Revert 561141d nfsd: Fix error cleanup path in nfsd_rename()
2 parents 50108c3 + 99dc2ef commit d8e8fbe

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

fs/nfsd/nfs4state.c

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,15 +3831,20 @@ nfsd4_create_session(struct svc_rqst *rqstp,
38313831
else
38323832
cs_slot = &unconf->cl_cs_slot;
38333833
status = check_slot_seqid(cr_ses->seqid, cs_slot->sl_seqid, 0);
3834-
if (status) {
3835-
if (status == nfserr_replay_cache) {
3836-
status = nfsd4_replay_create_session(cr_ses, cs_slot);
3837-
goto out_free_conn;
3838-
}
3834+
switch (status) {
3835+
case nfs_ok:
3836+
cs_slot->sl_seqid++;
3837+
cr_ses->seqid = cs_slot->sl_seqid;
3838+
break;
3839+
case nfserr_replay_cache:
3840+
status = nfsd4_replay_create_session(cr_ses, cs_slot);
3841+
fallthrough;
3842+
case nfserr_jukebox:
3843+
/* The server MUST NOT cache NFS4ERR_DELAY */
3844+
goto out_free_conn;
3845+
default:
38393846
goto out_cache_error;
38403847
}
3841-
cs_slot->sl_seqid++;
3842-
cr_ses->seqid = cs_slot->sl_seqid;
38433848

38443849
/* RFC 8881 Section 18.36.4 Phase 3: Client ID confirmation. */
38453850
if (conf) {
@@ -3859,10 +3864,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
38593864
old = find_confirmed_client_by_name(&unconf->cl_name, nn);
38603865
if (old) {
38613866
status = mark_client_expired_locked(old);
3862-
if (status) {
3863-
old = NULL;
3864-
goto out_cache_error;
3865-
}
3867+
if (status)
3868+
goto out_expired_error;
38663869
trace_nfsd_clid_replaced(&old->cl_clientid);
38673870
}
38683871
move_to_confirmed(unconf);
@@ -3894,6 +3897,17 @@ nfsd4_create_session(struct svc_rqst *rqstp,
38943897
expire_client(old);
38953898
return status;
38963899

3900+
out_expired_error:
3901+
old = NULL;
3902+
/*
3903+
* Revert the slot seq_nr change so the server will process
3904+
* the client's resend instead of returning a cached response.
3905+
*/
3906+
if (status == nfserr_jukebox) {
3907+
cs_slot->sl_seqid--;
3908+
cr_ses->seqid = cs_slot->sl_seqid;
3909+
goto out_free_conn;
3910+
}
38973911
out_cache_error:
38983912
nfsd4_cache_create_session(cr_ses, cs_slot, status);
38993913
out_free_conn:

fs/nfsd/vfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
18521852
trap = lock_rename(tdentry, fdentry);
18531853
if (IS_ERR(trap)) {
18541854
err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
1855-
goto out;
1855+
goto out_want_write;
18561856
}
18571857
err = fh_fill_pre_attrs(ffhp);
18581858
if (err != nfs_ok)
@@ -1922,6 +1922,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
19221922
}
19231923
out_unlock:
19241924
unlock_rename(tdentry, fdentry);
1925+
out_want_write:
19251926
fh_drop_write(ffhp);
19261927

19271928
/*

net/sunrpc/auth_gss/gss_krb5_crypto.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,6 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, u32 len,
921921
* Caller provides the truncation length of the output token (h) in
922922
* cksumout.len.
923923
*
924-
* Note that for RPCSEC, the "initial cipher state" is always all zeroes.
925-
*
926924
* Return values:
927925
* %GSS_S_COMPLETE: Digest computed, @cksumout filled in
928926
* %GSS_S_FAILURE: Call failed
@@ -933,19 +931,22 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher,
933931
int body_offset, struct xdr_netobj *cksumout)
934932
{
935933
unsigned int ivsize = crypto_sync_skcipher_ivsize(cipher);
936-
static const u8 iv[GSS_KRB5_MAX_BLOCKSIZE];
937934
struct ahash_request *req;
938935
struct scatterlist sg[1];
936+
u8 *iv, *checksumdata;
939937
int err = -ENOMEM;
940-
u8 *checksumdata;
941938

942939
checksumdata = kmalloc(crypto_ahash_digestsize(tfm), GFP_KERNEL);
943940
if (!checksumdata)
944941
return GSS_S_FAILURE;
942+
/* For RPCSEC, the "initial cipher state" is always all zeroes. */
943+
iv = kzalloc(ivsize, GFP_KERNEL);
944+
if (!iv)
945+
goto out_free_mem;
945946

946947
req = ahash_request_alloc(tfm, GFP_KERNEL);
947948
if (!req)
948-
goto out_free_cksumdata;
949+
goto out_free_mem;
949950
ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL);
950951
err = crypto_ahash_init(req);
951952
if (err)
@@ -969,7 +970,8 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher,
969970

970971
out_free_ahash:
971972
ahash_request_free(req);
972-
out_free_cksumdata:
973+
out_free_mem:
974+
kfree(iv);
973975
kfree_sensitive(checksumdata);
974976
return err ? GSS_S_FAILURE : GSS_S_COMPLETE;
975977
}

0 commit comments

Comments
 (0)