From: Jeremy Allison Date: Wed, 11 Mar 2020 22:16:35 +0000 (-0700) Subject: s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing. X-Git-Tag: ldb-2.2.0~1439 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4287ea138e82103cce0a939e504f9810636b4747;p=thirdparty%2Fsamba.git s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing. Eventually this will allow us to remove fsp->deferred_close from the fsp struct (and also source3/lib/tevent_wait.[ch]). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/offload_token.c b/source3/modules/offload_token.c index 3fb84dabdff..03bb3309f38 100644 --- a/source3/modules/offload_token.c +++ b/source3/modules/offload_token.c @@ -280,6 +280,16 @@ NTSTATUS vfs_offload_token_check_handles(uint32_t fsctl, return NT_STATUS_ACCESS_DENIED; } + if (src_fsp->closing) { + DBG_INFO("copy chunk src handle with closing in progress.\n"); + return NT_STATUS_ACCESS_DENIED; + } + + if (dst_fsp->closing) { + DBG_INFO("copy chunk dst handle with closing in progress.\n"); + return NT_STATUS_ACCESS_DENIED; + } + if (src_fsp->is_directory) { DBG_INFO("copy chunk no read on src directory handle (%s).\n", smb_fname_str_dbg(src_fsp->fsp_name)); diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 99b2f343685..b06511147ab 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -598,6 +598,9 @@ files_struct *file_fsp(struct smb_request *req, uint16_t fid) if (req->chain_fsp->deferred_close) { return NULL; } + if (req->chain_fsp->closing) { + return NULL; + } return req->chain_fsp; } @@ -622,6 +625,10 @@ files_struct *file_fsp(struct smb_request *req, uint16_t fid) return NULL; } + if (fsp->closing) { + return NULL; + } + req->chain_fsp = fsp; return fsp; } @@ -669,6 +676,10 @@ struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req, return NULL; } + if (fsp->closing) { + return NULL; + } + return fsp; } @@ -682,6 +693,9 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, if (smb2req->compat_chain_fsp->deferred_close) { return NULL; } + if (smb2req->compat_chain_fsp->closing) { + return NULL; + } return smb2req->compat_chain_fsp; }