2021-10-01 21:04 GMT+09:00, Ralph Boehme <slow@xxxxxxxxx>: > Cc: Namjae Jeon <linkinjeon@xxxxxxxxxx> > Cc: Tom Talpey <tom@xxxxxxxxxx> > Cc: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> > Cc: Steve French <smfrench@xxxxxxxxx> > Cc: Hyunchul Lee <hyc.lee@xxxxxxxxx> > Signed-off-by: Ralph Boehme <slow@xxxxxxxxx> > --- > fs/ksmbd/smb2pdu.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c > index 5b1fead05c49..ef551e3633db 100644 > --- a/fs/ksmbd/smb2pdu.c > +++ b/fs/ksmbd/smb2pdu.c > @@ -411,7 +411,6 @@ static void init_chained_smb2_rsp(struct ksmbd_work > *work) > work->compound_pfid = > le64_to_cpu(((struct smb2_create_rsp *)rsp)-> > PersistentFileId); > - work->compound_sid = le64_to_cpu(rsp->SessionId); > } > > len = get_rfc1002_len(work->response_buf) - work->next_smb2_rsp_hdr_off; > @@ -592,6 +591,8 @@ int smb2_check_user_session(struct ksmbd_work *work) > unsigned long long sess_id; > > work->sess = NULL; > + work->compound_sid = 0; > + > /* > * SMB2_ECHO, SMB2_NEGOTIATE, SMB2_SESSION_SETUP command do not > * require a session id, so no need to validate user session's for > @@ -604,11 +605,17 @@ int smb2_check_user_session(struct ksmbd_work *work) > if (!ksmbd_conn_good(work)) > return -EINVAL; > > - sess_id = le64_to_cpu(req_hdr->SessionId); > + if (req_hdr->Flags & SMB2_FLAGS_RELATED_OPERATIONS) > + sess_id = work->compound_sid; same comment with previous tree id patch. > + else > + sess_id = le64_to_cpu(req_hdr->SessionId); > + > /* Check for validity of user session */ > work->sess = ksmbd_session_lookup_all(conn, sess_id); > - if (work->sess) > + if (work->sess) { > + work->compound_sid = sess_id; > return 1; > + } > ksmbd_debug(SMB, "Invalid user session, Uid %llu\n", sess_id); > return -EINVAL; > } > -- > 2.31.1 > >