Skip to contentSkip to conversation

nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client.

PATCH In review Dai Ngo 3 participants 5 messages Jan 26, 2022 – Jan 28, 2022

Subsystems (2)
lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH 1/1 nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client.

From RFC 7530 Section 16.34.5:

o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }.

The current code intents to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired.

---
 fs/nfsd/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +3 -1
index 72900b89cf84..32063733443d 100644
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 			status = nfserr_clid_inuse;
 			if (client_has_state(old)
 					&& !same_creds(&unconf->cl_cred,
-							&old->cl_cred))
+							&old->cl_cred)) {
+				old = NULL;
 				goto out;
+			}
 			status = mark_client_expired_locked(old);
 			if (status) {
 				old = NULL;
Signature · 1 line
2.9.5
#1 lore raw

Hi Dai-

Quoted 11 lines · Dai Ngo

From RFC 7530 Section 16.34.5:

o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }.

Quoted 5 lines

The current code intents to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired.

On it's face, this seems like the correct thing to do.

I believe the issue was introduced in commit 2b63482185e6 ("nfsd:
fix clid_inuse on mount with security change") in 2015. I can add a Fixes: tag and apply this for 5.17-rc.

Quoted 23 lines

---
fs/nfsd/nfs4state.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +3 -1
index 72900b89cf84..32063733443d 100644
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 			status = nfserr_clid_inuse;
 			if (client_has_state(old)
 					&& !same_creds(&unconf->cl_cred,
-							&old->cl_cred))
+							&old->cl_cred)) {
+				old = NULL;
 				goto out;
+			}
 			status = mark_client_expired_locked(old);
 			if (status) {
 				old = NULL;
Signature · 1 line
2.9.5

--
Chuck Lever

#2 lore raw
Quoted 17 lines · Chuck Lever III

Hi Dai-

Quoted 15 lines · Dai Ngo

From RFC 7530 Section 16.34.5:

o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }.

The current code intents to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired.

Quoted 7 lines
Quoted 1 line

On it's face, this seems like the correct thing to do.

I believe the issue was introduced in commit 2b63482185e6 ("nfsd:
fix clid_inuse on mount with security change") in 2015. I can add a Fixes: tag and apply this for 5.17-rc.

Looks right to me too--thanks, Dai.

--b.

Quoted 28 lines
Quoted 23 lines

---
fs/nfsd/nfs4state.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +3 -1
index 72900b89cf84..32063733443d 100644
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 			status = nfserr_clid_inuse;
 			if (client_has_state(old)
 					&& !same_creds(&unconf->cl_cred,
-							&old->cl_cred))
+							&old->cl_cred)) {
+				old = NULL;
 				goto out;
+			}
 			status = mark_client_expired_locked(old);
 			if (status) {
 				old = NULL;
Signature · 1 line
2.9.5

--
Chuck Lever

#3 lore raw
Quoted 24 lines · J. Bruce Fields
Quoted 19 lines · Chuck Lever III

Hi Dai-

Quoted 16 lines · Dai Ngo

From RFC 7530 Section 16.34.5:

o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }.

The current code intents to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired.

Quoted 7 lines
Quoted 5 lines

On it's face, this seems like the correct thing to do.

I believe the issue was introduced in commit 2b63482185e6 ("nfsd:
fix clid_inuse on mount with security change") in 2015. I can add a Fixes: tag and apply this for 5.17-rc.

Looks right to me too--thanks, Dai.

May I add a Reviewed-by: Bruce ?

Quoted 29 lines

--b.

Quoted 26 lines
Quoted 23 lines

---
fs/nfsd/nfs4state.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +3 -1
index 72900b89cf84..32063733443d 100644
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 			status = nfserr_clid_inuse;
 			if (client_has_state(old)
 					&& !same_creds(&unconf->cl_cred,
-							&old->cl_cred))
+							&old->cl_cred)) {
+				old = NULL;
 				goto out;
+			}
 			status = mark_client_expired_locked(old);
 			if (status) {
 				old = NULL;
Signature · 1 line
2.9.5

--
Chuck Lever

--
Chuck Lever

#4 lore raw
Quoted 26 lines · Chuck Lever III
Quoted 26 lines · J. Bruce Fields
Quoted 21 lines · Chuck Lever III

Hi Dai-

Quoted 11 lines · Dai Ngo

From RFC 7530 Section 16.34.5:

o The server has not recorded an unconfirmed { v, x, c, *, * } and has recorded a confirmed { v, x, c, *, s }. If the principals of the record and of SETCLIENTID_CONFIRM do not match, the server returns NFS4ERR_CLID_INUSE without removing any relevant leased client state, and without changing recorded callback and callback_ident values for client { x }.

Quoted 5 lines

The current code intents to do what the spec describes above but it forgot to set 'old' to NULL resulting to the confirmed client to be expired.

On it's face, this seems like the correct thing to do.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I believe the issue was introduced in commit 2b63482185e6 ("nfsd:
fix clid_inuse on mount with security change") in 2015. I can add a Fixes: tag and apply this for 5.17-rc.

Looks right to me too--thanks, Dai.

May I add a Reviewed-by: Bruce ?

Sure.--b.