1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:smbd: protect smbd_do_unlocking() with share_mode_do_locked_vfs_allowed()

share_mode_do_locked() will be make static soon.

Here we just want to avoid concurrent access to brlock.tdb
in order to maintain the lock order, we're not interested in the
locking.tdb content at all, expect that there's at least one
entry and we want to wake potential watchers.

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>
This commit is contained in:
Stefan Metzmacher 2022-08-18 13:57:56 +02:00 committed by Jeremy Allison
parent f971a4ae31
commit 7c6113de2b

View File

@ -2129,9 +2129,7 @@ struct smbd_do_unlocking_state {
};
static void smbd_do_unlocking_fn(
const uint8_t *buf,
size_t buflen,
bool *pmodified_dependent,
struct share_mode_lock *lck,
void *private_data)
{
struct smbd_do_unlocking_state *state = private_data;
@ -2165,7 +2163,7 @@ static void smbd_do_unlocking_fn(
}
}
*pmodified_dependent = true;
share_mode_wakeup_waiters(fsp->file_id);
}
NTSTATUS smbd_do_unlocking(struct smb_request *req,
@ -2182,11 +2180,11 @@ NTSTATUS smbd_do_unlocking(struct smb_request *req,
DBG_NOTICE("%s num_ulocks=%"PRIu16"\n", fsp_fnum_dbg(fsp), num_ulocks);
status = share_mode_do_locked(
status = share_mode_do_locked_vfs_allowed(
fsp->file_id, smbd_do_unlocking_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("share_mode_do_locked failed: %s\n",
DBG_DEBUG("share_mode_do_locked_vfs_allowed failed: %s\n",
nt_errstr(status));
return status;
}