Commit 2e5700bd authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French
Browse files

smb3: add credits we receive from oplock/break PDUs



Otherwise we gradually leak credits leading to potential
hung session.

Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: default avatarPavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 6a9cbdd1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -648,6 +648,13 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
	if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK)
		return false;

	if (rsp->sync_hdr.CreditRequest) {
		spin_lock(&server->req_lock);
		server->credits += le16_to_cpu(rsp->sync_hdr.CreditRequest);
		spin_unlock(&server->req_lock);
		wake_up(&server->request_q);
	}

	if (rsp->StructureSize !=
				smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) {
		if (le16_to_cpu(rsp->StructureSize) == 44)