Skip to content

Commit cf1d2c3

Browse files
committed
Merge tag 'nfsd-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: "Critical bug fixes: - Fix crash in NLM TEST procedure - NFSv4.1+ backchannel not restored after PATH_DOWN" * tag 'nfsd-5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: nfsd: back channel stuck in SEQ4_STATUS_CB_PATH_DOWN NLM: Fix svcxdr_encode_owner()
2 parents bee4251 + 02579b2 commit cf1d2c3

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

fs/lockd/svcxdr.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,9 @@ svcxdr_decode_owner(struct xdr_stream *xdr, struct xdr_netobj *obj)
134134
static inline bool
135135
svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
136136
{
137-
unsigned int quadlen = XDR_QUADLEN(obj->len);
138-
__be32 *p;
139-
140-
if (xdr_stream_encode_u32(xdr, obj->len) < 0)
141-
return false;
142-
p = xdr_reserve_space(xdr, obj->len);
143-
if (!p)
137+
if (obj->len > XDR_MAX_NETOBJ)
144138
return false;
145-
p[quadlen - 1] = 0; /* XDR pad */
146-
memcpy(p, obj->data, obj->len);
147-
148-
return true;
139+
return xdr_stream_encode_opaque(xdr, obj->data, obj->len) > 0;
149140
}
150141

151142
#endif /* _LOCKD_SVCXDR_H_ */

fs/nfsd/nfs4state.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3570,7 +3570,7 @@ static struct nfsd4_conn *__nfsd4_find_conn(struct svc_xprt *xpt, struct nfsd4_s
35703570
}
35713571

35723572
static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst,
3573-
struct nfsd4_session *session, u32 req)
3573+
struct nfsd4_session *session, u32 req, struct nfsd4_conn **conn)
35743574
{
35753575
struct nfs4_client *clp = session->se_client;
35763576
struct svc_xprt *xpt = rqst->rq_xprt;
@@ -3593,6 +3593,8 @@ static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst,
35933593
else
35943594
status = nfserr_inval;
35953595
spin_unlock(&clp->cl_lock);
3596+
if (status == nfs_ok && conn)
3597+
*conn = c;
35963598
return status;
35973599
}
35983600

@@ -3617,8 +3619,16 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp,
36173619
status = nfserr_wrong_cred;
36183620
if (!nfsd4_mach_creds_match(session->se_client, rqstp))
36193621
goto out;
3620-
status = nfsd4_match_existing_connection(rqstp, session, bcts->dir);
3621-
if (status == nfs_ok || status == nfserr_inval)
3622+
status = nfsd4_match_existing_connection(rqstp, session,
3623+
bcts->dir, &conn);
3624+
if (status == nfs_ok) {
3625+
if (bcts->dir == NFS4_CDFC4_FORE_OR_BOTH ||
3626+
bcts->dir == NFS4_CDFC4_BACK)
3627+
conn->cn_flags |= NFS4_CDFC4_BACK;
3628+
nfsd4_probe_callback(session->se_client);
3629+
goto out;
3630+
}
3631+
if (status == nfserr_inval)
36223632
goto out;
36233633
status = nfsd4_map_bcts_dir(&bcts->dir);
36243634
if (status)

0 commit comments

Comments
 (0)