From: Ralph Boehme Date: Fri, 7 Mar 2025 13:51:26 +0000 (+0100) Subject: s3:locking: make sure brl_conflict_posix() is only called with 2 POSIX_LOCKS X-Git-Tag: tevent-0.17.0~575 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8b49a59ee424b77942d0e68eb97f3e267264a09;p=thirdparty%2Fsamba.git s3:locking: make sure brl_conflict_posix() is only called with 2 POSIX_LOCKS Otherwise we hit the assert if the caller is a windows lock and the conflicting one a posix lock. Or in the non-developer build we don't enforce the windows locking rules. Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Ralph Boehme Signed-off-by: Stefan Metzmacher --- diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 9b42068a66c..0c5dab19389 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -246,10 +246,8 @@ static bool brl_conflict(const struct lock_struct *lck1, static bool brl_conflict_posix(const struct lock_struct *lck1, const struct lock_struct *lck2) { -#if defined(DEVELOPER) SMB_ASSERT(lck1->lock_flav == POSIX_LOCK); SMB_ASSERT(lck2->lock_flav == POSIX_LOCK); -#endif /* Read locks never conflict. */ if (lck1->lock_type == READ_LOCK && lck2->lock_type == READ_LOCK) { @@ -1276,10 +1274,10 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, const struct lock_struct *exlock = &locks[i]; bool conflict = False; - if (exlock->lock_flav == WINDOWS_LOCK) { - conflict = brl_conflict(exlock, &lock); - } else { + if (lock_flav == POSIX_LOCK && exlock->lock_flav == POSIX_LOCK) { conflict = brl_conflict_posix(exlock, &lock); + } else { + conflict = brl_conflict(exlock, &lock); } if (conflict) {