Commits

Anonymous committed 29b0d8e

mali: Fix waiting_soft_jobs list corruption during zap context.

Bug: 8700991
Change-Id: Iee677a32f16926f3802c65e2b13881fc211efb02

Comments (0)

Files changed (1)

drivers/gpu/arm/t6xx/kbase/src/common/mali_kbase_jd.c

 void kbase_jd_zap_context(kbase_context *kctx)
 {
 	kbase_jd_atom *katom;
+#ifdef CONFIG_KDS
 	struct list_head *entry;
+#endif
 	kbase_device *kbdev;
 	zap_reset_data reset_data;
 	unsigned long flags;
 	 * queued outside the job scheduler.
 	 */
 
-	list_for_each(entry, &kctx->waiting_soft_jobs) {
-		katom = list_entry(entry, kbase_jd_atom, dep_item[0]);
-
+	while (!list_empty(&kctx->waiting_soft_jobs)) {
+		katom = list_first_entry(&kctx->waiting_soft_jobs,
+					kbase_jd_atom,
+					dep_item[0]);
+		list_del(&katom->dep_item[0]);
 		kbase_cancel_soft_job(katom);
 	}