ksmbd: fix outstanding credits related bugs
Subsystems (3)
PATCH v2 1/1 ksmbd: fix outstanding credits related bugs
outstanding credits must be initialized to 0,
because it means the sum of credits consumed by
in-flight requests.
And outstanding credits must be compared with
total credits in smb2_validate_credit_charge(),
because total credits are the sum of credits
granted by ksmbd.
This patch fix the following error,
while frametest with Windows clients:
Limits exceeding the maximum allowable outstanding requests, given : 128, pending : 8065
---
changes from v1:
- Add "Fixes" and stable tags
fs/ksmbd/connection.c | 2 +- fs/ksmbd/smb2misc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ksmbd/connection.c +1 -1
@@ -62,7 +62,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(void)atomic_set (&conn->req_running,0 );atomic_set (&conn->r_count,0 ); conn->total_credits =1 ; - conn->outstanding_credits =1 ; + conn->outstanding_credits =0 ;init_waitqueue_head (&conn->req_running_q);INIT_LIST_HEAD (&conn->conns_list);
fs/ksmbd/smb2misc.c +1 -1
@@ -338,7 +338,7 @@ static int smb2_validate_credit_charge(struct ksmbd_conn *conn, ret =1 ; } -if ((u64 )conn->outstanding_credits + credit_charge > conn->vals->max_credits) { +if ((u64 )conn->outstanding_credits + credit_charge > conn->total_credits) {ksmbd_debug (SMB ,"Limits exceeding the maximum allowable outstanding requests, given : %u, pending : %u\n" , credit_charge, conn->outstanding_credits); ret =1 ;
Signature · 1 line
2.25.1
Namjae Jeon
maintainer2022-05-19 22:00 GMT+09:00, Hyunchul Lee <[email protected]>:
Quoted 33 lines
outstanding credits must be initialized to 0,
because it means the sum of credits consumed by
in-flight requests.
And outstanding credits must be compared with
total credits insmb2_validate_credit_charge(),
because total credits are the sum of credits
granted by ksmbd.This patch fix the following error,
while frametest with Windows clients:Limits exceeding the maximum allowable outstanding requests, given : 128, pending : 8065
Fixes b589f5db6d4a ("ksmbd: limits exceeding the maximum allowableoutstanding requests")
Signed-off-by Hyunchul Lee <[email protected]>Reported-by Yufan Chen <[email protected]>Tested-by Yufan Chen <[email protected]>---
changes from v1:
- Add "Fixes" and stable tagsfs/ksmbd/connection.c | 2 +- fs/ksmbd/smb2misc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)fs/ksmbd/connection.c +0
-0
fs/ksmbd/connection.c struct ksmbd_conn *ksmbd_conn_alloc(void) · line 65
Quoted 5 lines
fs/ksmbd/connection.c +1
-1@@ -62,7 +62,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(void)atomic_set (&conn->req_running,0 );atomic_set (&conn->r_count,0 ); conn->total_credits =1 ; - conn->outstanding_credits =1 ; + conn->outstanding_credits =0 ;
You need to consider auto negotiation from windows client connection. So it will cause integer underflow issue.
Quoted 24 lines
fs/ksmbd/connection.c +0
-0init_waitqueue_head (&conn->req_running_q);INIT_LIST_HEAD (&conn->conns_list);fs/ksmbd/smb2misc.c +1
-1@@ -338,7 +338,7 @@ static int smb2_validate_credit_charge(struct ksmbd_conn *conn, ret =1 ; } -if ((u64 )conn->outstanding_credits + credit_charge > conn->vals->max_credits) { +if ((u64 )conn->outstanding_credits + credit_charge > conn->total_credits) {ksmbd_debug(SMB, "Limits exceeding the maximum allowable outstanding
requests, given : %u, pending : %u\n",fs/ksmbd/smb2misc.c +0
-1credit_charge, conn->outstanding_credits); ret =1 ; --2.25.1