Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8694f8c8 authored by Tejas Prajapati's avatar Tejas Prajapati
Browse files

msm: camera: reqmgr: check validity of last_applied_idx



last_applied_idx is updated on every successful applied
request and the buf_done. After buf_done last_applied_idx
is set to -1. While accessing last applied req the same
index is used, if the last_applied_idx is -1 accessing
last applied request will result in slab out of bound
error, so check last_applied_idx before accessing
last applied request.

CRs-Fixed: 2840329
Change-Id: I8f49b9df097859cde20e651149167db7316976bb
Signed-off-by: default avatarTejas Prajapati <tpraja@codeaurora.org>
parent e85bc421
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2072,7 +2072,9 @@ static int __cam_req_mgr_process_sof_freeze(void *priv, void *data)
	in_q = link->req.in_q;
	if (in_q) {
		mutex_lock(&link->req.lock);
		last_applied_req_id = in_q->slot[in_q->last_applied_idx].req_id;
		if (in_q->last_applied_idx >= 0)
			last_applied_req_id =
				in_q->slot[in_q->last_applied_idx].req_id;
		mutex_unlock(&link->req.lock);
	}