diff options
author | Namjae Jeon <linkinjeon@kernel.org> | 2023-05-12 17:29:12 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-05-27 04:27:46 +0300 |
commit | 84c5aa47925a1f40d698b6a6a2bf67e99617433d (patch) | |
tree | 638999f4ab2e1c7597566d0605f7bd2875e5cbb6 /fs/smb/server | |
parent | df14afeed2e6c1bbadef7d2f9c46887bbd6d8d94 (diff) | |
download | linux-84c5aa47925a1f40d698b6a6a2bf67e99617433d.tar.xz |
ksmbd: fix credit count leakage
This patch fix the failure from smb2.credits.single_req_credits_granted
test. When client send 8192 credit request, ksmbd return 8191 credit
granted. ksmbd should give maximum possible credits that must be granted
within the range of not exceeding the max credit to client.
Cc: stable@vger.kernel.org
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/server')
-rw-r--r-- | fs/smb/server/smb2pdu.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c index 1632b2a1e516..bec885c007ce 100644 --- a/fs/smb/server/smb2pdu.c +++ b/fs/smb/server/smb2pdu.c @@ -326,13 +326,9 @@ int smb2_set_rsp_credits(struct ksmbd_work *work) if (hdr->Command == SMB2_NEGOTIATE) aux_max = 1; else - aux_max = conn->vals->max_credits - credit_charge; + aux_max = conn->vals->max_credits - conn->total_credits; credits_granted = min_t(unsigned short, credits_requested, aux_max); - if (conn->vals->max_credits - conn->total_credits < credits_granted) - credits_granted = conn->vals->max_credits - - conn->total_credits; - conn->total_credits += credits_granted; work->credits_granted += credits_granted; |