mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
ksmbd: add bounds check for create lease context
commit bab703ed8472aa9d109c5f8c1863921533363dae upstream. Add missing bounds check for create lease context. Cc: stable@vger.kernel.org Reported-by: Norbert Szetei <norbert@doyensec.com> Tested-by: Norbert Szetei <norbert@doyensec.com> Signed-off-by: Norbert Szetei <norbert@doyensec.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8857a956f7
commit
629dd37acc
@@ -1534,6 +1534,10 @@ struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
|
|||||||
if (sizeof(struct lease_context_v2) == le32_to_cpu(cc->DataLength)) {
|
if (sizeof(struct lease_context_v2) == le32_to_cpu(cc->DataLength)) {
|
||||||
struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
|
struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
|
||||||
|
|
||||||
|
if (le16_to_cpu(cc->DataOffset) + le32_to_cpu(cc->DataLength) <
|
||||||
|
sizeof(struct create_lease_v2) - 4)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
|
memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
|
||||||
if (is_dir) {
|
if (is_dir) {
|
||||||
lreq->req_state = lc->lcontext.LeaseState &
|
lreq->req_state = lc->lcontext.LeaseState &
|
||||||
@@ -1551,6 +1555,10 @@ struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
|
|||||||
} else {
|
} else {
|
||||||
struct create_lease *lc = (struct create_lease *)cc;
|
struct create_lease *lc = (struct create_lease *)cc;
|
||||||
|
|
||||||
|
if (le16_to_cpu(cc->DataOffset) + le32_to_cpu(cc->DataLength) <
|
||||||
|
sizeof(struct create_lease))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
|
memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
|
||||||
lreq->req_state = lc->lcontext.LeaseState;
|
lreq->req_state = lc->lcontext.LeaseState;
|
||||||
lreq->flags = lc->lcontext.LeaseFlags;
|
lreq->flags = lc->lcontext.LeaseFlags;
|
||||||
|
|||||||
Reference in New Issue
Block a user