All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] NFSD: detect mismatch of file handle and delegation stateid in OPEN op
@ 2025-06-10 13:41 Dai Ngo
  2025-06-10 13:50 ` Chuck Lever
  2025-06-10 13:50 ` Jeff Layton
  0 siblings, 2 replies; 13+ messages in thread
From: Dai Ngo @ 2025-06-10 13:41 UTC (permalink / raw)
  To: chuck.lever, jlayton, neilb, okorniev, tom; +Cc: linux-nfs

When the client sends an OPEN with claim type CLAIM_DELEG_CUR_FH or
CLAIM_DELEGATION_CUR, the delegation stateid and the file handle
must belongs to the same file, otherwise return NFS4ERR_BAD_STATEID.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/nfs4state.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 59a693f22452..be2ee641a22d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -6318,6 +6318,11 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 		status = nfs4_check_deleg(cl, open, &dp);
 		if (status)
 			goto out;
+		if (dp && nfsd4_is_deleg_cur(open) &&
+				(dp->dl_stid.sc_file != fp)) {
+			status = nfserr_bad_stateid;
+			goto out;
+		}
 		stp = nfsd4_find_and_lock_existing_open(fp, open);
 	} else {
 		open->op_file = NULL;
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-06-11  0:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 13:41 [PATCH 1/1] NFSD: detect mismatch of file handle and delegation stateid in OPEN op Dai Ngo
2025-06-10 13:50 ` Chuck Lever
2025-06-10 13:55   ` Jeff Layton
2025-06-10 13:50 ` Jeff Layton
2025-06-10 13:52   ` Chuck Lever
2025-06-10 13:59     ` Jeff Layton
2025-06-10 14:01       ` Chuck Lever
2025-06-10 14:12         ` Dai Ngo
2025-06-10 14:14           ` Chuck Lever
2025-06-10 14:53             ` Frank Filz
2025-06-10 15:05               ` Dai Ngo
2025-06-10 22:03                 ` Calum Mackay
2025-06-11  0:35                   ` Dai Ngo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.