فهرست منبع

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: Tejas Prajapati <[email protected]>
Tejas Prajapati 4 سال پیش
والد
کامیت
f2e4175ff2
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      drivers/cam_req_mgr/cam_req_mgr_core.c

+ 3 - 1
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -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);
 	}