From: Stefan Metzmacher Date: Fri, 26 Aug 2022 09:17:51 +0000 (+0200) Subject: s3:locking: let reset_delete_on_close_lck() use share_mode_lock_access_private_data() X-Git-Tag: talloc-2.4.0~889 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d982e8558567c6baaae888e023bde5a83ca1714;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- 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; inum_delete_tokens; i++) { struct delete_token *dt = &d->delete_tokens[i];