From ede6f448215a4ee81a1c7701c1cead2cc0a33198 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Mar 2014 14:53:14 +0100 Subject: [PATCH] smbd: Avoid checking the_lock->id for fresh locks If we just fetched the lock, this check will always be true. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/locking/share_mode_lock.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 5d0874c3be1..a34f3043b1d 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -385,15 +385,16 @@ struct share_mode_lock *get_share_mode_lock( } talloc_set_destructor(the_lock, the_lock_destructor); } else { + if (!file_id_equal(&the_lock->data->id, &id)) { + DEBUG(1, ("Can not lock two share modes " + "simultaneously\n")); + goto fail; + } if (talloc_reference(lck, the_lock) == NULL) { DEBUG(1, ("talloc_reference failed\n")); goto fail; } } - if (!file_id_equal(&the_lock->data->id, &id)) { - DEBUG(1, ("Can not lock two share modes simultaneously\n")); - goto fail; - } lck->data = the_lock->data; return lck; fail: -- 2.11.4.GIT