Skip to content

Commit 113ed70

Browse files
committed
SMB3: Do not send lease break acknowledgment if all file handles have been closed
jira VULN-131073 cve-pre CVE-2025-38527 commit-author Bharath SM <[email protected]> commit da787d5 In case if all existing file handles are deferred handles and if all of them gets closed due to handle lease break then we dont need to send lease break acknowledgment to server, because last handle close will be considered as lease break ack. After closing deferred handels, we check for openfile list of inode, if its empty then we skip sending lease break ack. Fixes: 59a556a ("SMB3: drop reference to cfile before sending oplock break") Reviewed-by: Tom Talpey <[email protected]> Signed-off-by: Bharath SM <[email protected]> Signed-off-by: Steve French <[email protected]> (cherry picked from commit da787d5) Signed-off-by: Brett Mastbergen <[email protected]>
1 parent f34ffb6 commit 113ed70

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

fs/cifs/file.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5106,20 +5106,19 @@ void cifs_oplock_break(struct work_struct *work)
51065106

51075107
_cifsFileInfo_put(cfile, false /* do not wait for ourself */, false);
51085108
/*
5109-
* releasing stale oplock after recent reconnect of smb session using
5110-
* a now incorrect file handle is not a data integrity issue but do
5111-
* not bother sending an oplock release if session to server still is
5112-
* disconnected since oplock already released by the server
5109+
* MS-SMB2 3.2.5.19.1 and 3.2.5.19.2 (and MS-CIFS 3.2.5.42) do not require
5110+
* an acknowledgment to be sent when the file has already been closed.
5111+
* check for server null, since can race with kill_sb calling tree disconnect.
51135112
*/
5114-
if (!oplock_break_cancelled) {
5115-
/* check for server null since can race with kill_sb calling tree disconnect */
5116-
if (tcon->ses && tcon->ses->server) {
5117-
rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
5118-
volatile_fid, net_fid, cinode);
5119-
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
5120-
} else
5121-
pr_warn_once("lease break not sent for unmounted share\n");
5122-
}
5113+
spin_lock(&cinode->open_file_lock);
5114+
if (tcon->ses && tcon->ses->server && !oplock_break_cancelled &&
5115+
!list_empty(&cinode->openFileList)) {
5116+
spin_unlock(&cinode->open_file_lock);
5117+
rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
5118+
volatile_fid, net_fid, cinode);
5119+
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
5120+
} else
5121+
spin_unlock(&cinode->open_file_lock);
51235122

51245123
cifs_done_oplock_break(cinode);
51255124
}

0 commit comments

Comments
 (0)