From: Stefan Metzmacher Date: Sat, 3 Sep 2022 00:46:34 +0000 (+0200) Subject: s3:smbd: add smb_vfs_assert_allowed() to kernel oplock code X-Git-Tag: talloc-2.4.0~900 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa7df0fb9fa62cf2f6bc774c020da26ce878e7b0;p=thirdparty%2Fsamba.git s3:smbd: add smb_vfs_assert_allowed() to kernel oplock code 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index 404746d6f6a..c4f4fb3ac33 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -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");