diff options
author | Stefan Metzmacher <metze@samba.org> | 2022-08-26 11:17:51 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-09-20 00:34:35 +0000 |
commit | 7d982e8558567c6baaae888e023bde5a83ca1714 (patch) | |
tree | 2b0040981d6f7fb2c86a59e2730769bb60721b0a | |
parent | 45253acc81e613d0ab6a47d55c008f95af421bf1 (diff) | |
download | samba-7d982e8558567c6baaae888e023bde5a83ca1714.tar.gz |
s3:locking: let reset_delete_on_close_lck() use share_mode_lock_access_private_data()
We should avoid dereference 'struct share_mode_lock' as much as possible.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/locking/locking.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 4c20ff2c354..42880f7ce1c 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -808,9 +808,19 @@ static bool add_delete_on_close_token(struct share_mode_data *d, void reset_delete_on_close_lck(files_struct *fsp, struct share_mode_lock *lck) { - struct share_mode_data *d = lck->data; + struct share_mode_data *d = NULL; + NTSTATUS status; uint32_t i; + status = share_mode_lock_access_private_data(lck, &d); + if (!NT_STATUS_IS_OK(status)) { + /* Any error recovery possible here ? */ + DBG_ERR("share_mode_lock_access_private_data() failed for " + "%s - %s\n", fsp_str_dbg(fsp), nt_errstr(status)); + smb_panic(__location__); + return; + } + for (i=0; i<d->num_delete_tokens; i++) { struct delete_token *dt = &d->delete_tokens[i]; |