Skip to contentSkip to conversation

nfsd: COPY and CLONE operations require the saved filehandle to be set

PATCH In review Scott Mayhew 2 participants 2 messages Nov 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsd: COPY and CLONE operations require the saved filehandle to be set

Make sure we have a saved filehandle, otherwise we'll oops with a null pointer dereference in nfs4_preprocess_stateid_op().

---
 fs/nfsd/nfs4proc.c | 3 +++
 1 file changed, 3 insertions(+)
fs/nfsd/nfs4proc.c +3 -0
index edff074d38c7..d505990dac7c 100644
@@ -1038,6 +1038,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 {
 	__be32 status;
 
+	if (!cstate->save_fh.fh_dentry)
+		return nfserr_nofilehandle;
+
 	status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh,
 					    src_stateid, RD_STATE, src, NULL);
 	if (status) {
Signature · 1 line
2.17.1
#1 lore raw

Applying for 4.20 and stable, thanks!

--b.

Quoted 24 lines · Scott Mayhew

Make sure we have a saved filehandle, otherwise we'll oops with a null pointer dereference in nfs4_preprocess_stateid_op().

---
 fs/nfsd/nfs4proc.c | 3 +++
 1 file changed, 3 insertions(+)
fs/nfsd/nfs4proc.c +3 -0
index edff074d38c7..d505990dac7c 100644
@@ -1038,6 +1038,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 {
 	__be32 status;
 
+	if (!cstate->save_fh.fh_dentry)
+		return nfserr_nofilehandle;
+
 	status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh,
 					    src_stateid, RD_STATE, src, NULL);
 	if (status) {
Signature · 1 line
2.17.1