From: Volker Lendecke Date: Tue, 17 Dec 2019 13:23:16 +0000 (+0100) Subject: smbd: Avoid a direct access to share_mode_data->num_share_modes X-Git-Tag: ldb-2.1.0~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42ce74994e98dda95c32d3fcbd66d825f6d84519;p=thirdparty%2Fsamba.git smbd: Avoid a direct access to share_mode_data->num_share_modes Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d1c3f6badc8..a999f86dd44 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1811,7 +1811,7 @@ static NTSTATUS open_mode_check(connection_struct *conn, struct share_mode_data *d = lck->data; struct open_mode_check_state state; uint16_t new_flags; - bool ok, conflict; + bool ok, conflict, have_share_entries; if (is_stat_open(access_mask)) { /* Stat open that doesn't trigger oplock breaks or share mode @@ -1836,7 +1836,12 @@ static NTSTATUS open_mode_check(connection_struct *conn, } #endif - if (d->num_share_modes == 0) { + have_share_entries = share_mode_have_entries(lck); + if (!have_share_entries) { + /* + * This is a fresh share mode lock where no conflicts + * can happen. + */ return NT_STATUS_OK; }