summaryrefslogtreecommitdiff
path: root/fs/smb/client/smb2ops.c
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2023-06-09 20:46:58 +0300
committerSteve French <stfrench@microsoft.com>2023-06-12 04:52:49 +0300
commit5e90aa21eb1372736e08cee0c0bf47735c5c4b95 (patch)
tree0a7c1b8733baf9534e469fb152c6adb41e92a16e /fs/smb/client/smb2ops.c
parent2991b77409891e14a10b96899755c004b0c07edb (diff)
downloadlinux-5e90aa21eb1372736e08cee0c0bf47735c5c4b95.tar.xz
cifs: fix max_credits implementation
The current implementation of max_credits on the client does not work because the CreditRequest logic for several commands does not take max_credits into account. Still, we can end up asking the server for more credits, depending on the number of credits in flight. For this, we need to limit the credits while parsing the responses too. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/smb2ops.c')
-rw-r--r--fs/smb/client/smb2ops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 8bceb54ab061..bbb19bbb14c9 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -34,6 +34,8 @@ static int
change_conf(struct TCP_Server_Info *server)
{
server->credits += server->echo_credits + server->oplock_credits;
+ if (server->credits > server->max_credits)
+ server->credits = server->max_credits;
server->oplock_credits = server->echo_credits = 0;
switch (server->credits) {
case 0: