File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -459,13 +459,22 @@ static void init_chained_smb2_rsp(struct ksmbd_work *work)
459
459
bool is_chained_smb2_message (struct ksmbd_work * work )
460
460
{
461
461
struct smb2_hdr * hdr = work -> request_buf ;
462
- unsigned int len ;
462
+ unsigned int len , next_cmd ;
463
463
464
464
if (hdr -> ProtocolId != SMB2_PROTO_NUMBER )
465
465
return false;
466
466
467
467
hdr = ksmbd_req_buf_next (work );
468
- if (le32_to_cpu (hdr -> NextCommand ) > 0 ) {
468
+ next_cmd = le32_to_cpu (hdr -> NextCommand );
469
+ if (next_cmd > 0 ) {
470
+ if ((u64 )work -> next_smb2_rcv_hdr_off + next_cmd +
471
+ __SMB2_HEADER_STRUCTURE_SIZE >
472
+ get_rfc1002_len (work -> request_buf )) {
473
+ pr_err ("next command(%u) offset exceeds smb msg size\n" ,
474
+ next_cmd );
475
+ return false;
476
+ }
477
+
469
478
ksmbd_debug (SMB , "got SMB2 chained command\n" );
470
479
init_chained_smb2_rsp (work );
471
480
return true;
You can’t perform that action at this time.
0 commit comments