diff --git a/ksmbd_work.c b/ksmbd_work.c index ad257207..a5cafaf1 100644 --- a/ksmbd_work.c +++ b/ksmbd_work.c @@ -157,3 +157,10 @@ int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len, { return __ksmbd_iov_pin_rsp(work, ib, len, aux_buf, aux_size); } + +void ksmbd_iov_reset(struct ksmbd_work *work) +{ + work->iov_idx = 0; + work->iov_cnt = 0; + work->iov[0].iov_base = 0; +} diff --git a/ksmbd_work.h b/ksmbd_work.h index fe74cc5a..0f2a9742 100644 --- a/ksmbd_work.h +++ b/ksmbd_work.h @@ -133,4 +133,5 @@ bool ksmbd_queue_work(struct ksmbd_work *work); int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len, void *aux_buf, unsigned int aux_size); int ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len); +void ksmbd_iov_reset(struct ksmbd_work *work); #endif /* __KSMBD_WORK_H__ */ diff --git a/oplock.c b/oplock.c index 513afb1a..992ecd72 100644 --- a/oplock.c +++ b/oplock.c @@ -1045,6 +1045,7 @@ static int smb2_lease_break_noti(struct oplock_info *opinfo) setup_async_work(in_work, NULL, NULL); smb2_send_interim_resp(in_work, STATUS_PENDING); list_del(&in_work->interim_entry); + ksmbd_iov_reset(in_work); } INIT_WORK(&work->work, __smb2_lease_break_noti); ksmbd_queue_work(work); diff --git a/smb2pdu.c b/smb2pdu.c index c165f426..7b84f30a 100644 --- a/smb2pdu.c +++ b/smb2pdu.c @@ -661,7 +661,7 @@ int setup_async_work(struct ksmbd_work *work, void (*fn)(void **), void **arg) struct ksmbd_conn *conn = work->conn; int id; - rsp_hdr = smb2_get_msg(work->response_buf); + rsp_hdr = ksmbd_req_buf_next(work->response_buf); rsp_hdr->Flags |= SMB2_FLAGS_ASYNC_COMMAND; id = ksmbd_acquire_async_msg_id(&conn->async_ida); @@ -711,7 +711,7 @@ void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status) { struct smb2_hdr *rsp_hdr; - rsp_hdr = smb2_get_msg(work->response_buf); + rsp_hdr = ksmbd_req_buf_next(work->response_buf); smb2_set_err_rsp(work); rsp_hdr->Status = status; @@ -7647,6 +7647,8 @@ int smb2_lock(struct ksmbd_work *work) list_del(&work->fp_entry); spin_unlock(&fp->f_lock); + ksmbd_iov_reset(work); + if (work->state != KSMBD_WORK_ACTIVE) { list_del(&smb_lock->llist); spin_lock(&work->conn->llist_lock);