aboutsummaryrefslogtreecommitdiff
path: root/fs/ksmbd/smb2misc.c
diff options
context:
space:
mode:
authorGravatar Namjae Jeon <namjae.jeon@samsung.com> 2021-07-16 14:52:46 +0900
committerGravatar Namjae Jeon <namjae.jeon@samsung.com> 2021-07-19 16:20:02 +0900
commit67307023d02b1339e0b930b742fe5a9cd81284ca (patch)
treefb0b12318a75701e4a167075920004bfa5496364 /fs/ksmbd/smb2misc.c
parentksmbd: fix wrong error status return on session setup (diff)
downloadlinux-67307023d02b1339e0b930b742fe5a9cd81284ca.tar.gz
linux-67307023d02b1339e0b930b742fe5a9cd81284ca.tar.bz2
linux-67307023d02b1339e0b930b742fe5a9cd81284ca.zip
ksmbd: set STATUS_INVALID_PARAMETER error status if credit charge is invalid
MS-SMB2 specification describe : If the calculated credit number is greater than the CreditCharge, the server MUST fail the request with the error code STATUS_INVALID_PARAMETER. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/smb2misc.c')
-rw-r--r--fs/ksmbd/smb2misc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/ksmbd/smb2misc.c b/fs/ksmbd/smb2misc.c
index 4508631c5706..e68aa7d718ed 100644
--- a/fs/ksmbd/smb2misc.c
+++ b/fs/ksmbd/smb2misc.c
@@ -423,8 +423,13 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work)
return 1;
}
- return work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU ?
- smb2_validate_credit_charge(hdr) : 0;
+ if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
+ smb2_validate_credit_charge(hdr)) {
+ work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
+ return 1;
+ }
+
+ return 0;
}
int smb2_negotiate_request(struct ksmbd_work *work)