]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: add smb_vfs_assert_allowed() to kernel oplock code
authorStefan Metzmacher <metze@samba.org>
Sat, 3 Sep 2022 00:46:34 +0000 (02:46 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 20 Sep 2022 00:34:35 +0000 (00:34 +0000)
Kernel oplocks can block in the same way vfs operations can do.

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>
source3/smbd/smb2_oplock.c

index 404746d6f6aa56238d0e9aee6f62129c411cac57..c4f4fb3ac3360af6cd592933ae823117f1666455 100644 (file)
@@ -61,6 +61,8 @@ NTSTATUS set_file_oplock(files_struct *fsp)
                        (koplocks != NULL);
        struct file_id_buf buf;
 
+       smb_vfs_assert_allowed();
+
        if (fsp->oplock_type == LEVEL_II_OPLOCK && use_kernel) {
                DEBUG(10, ("Refusing level2 oplock, kernel oplocks "
                           "don't support them\n"));
@@ -98,6 +100,8 @@ static void release_fsp_kernel_oplock(files_struct *fsp)
        struct kernel_oplocks *koplocks = sconn->oplocks.kernel_ops;
        bool use_kernel;
 
+       smb_vfs_assert_allowed();
+
        if (koplocks == NULL) {
                return;
        }
@@ -154,6 +158,8 @@ static void downgrade_file_oplock(files_struct *fsp)
        bool use_kernel = lp_kernel_oplocks(SNUM(fsp->conn)) &&
                        (koplocks != NULL);
 
+       smb_vfs_assert_allowed();
+
        if (!EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
                DEBUG(0, ("trying to downgrade an already-downgraded oplock!\n"));
                return;
@@ -836,6 +842,8 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
        uint16_t break_to;
        bool break_needed = true;
 
+       smb_vfs_assert_allowed();
+
        msg = talloc(talloc_tos(), struct oplock_break_message);
        if (msg == NULL) {
                DBG_WARNING("talloc failed\n");