MGS-3531 [#imx-865] fix gpu kernel panic issue
authorXianzhong <xianzhong.li@nxp.com>
Fri, 22 Dec 2017 20:56:32 +0000 (04:56 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:52:08 +0000 (14:52 -0500)
it is reproduced easily with multiple es11 cts tests,
gpu kernel panic in function _ConvertLogical2Physical.

need remove mdl from global list before destroy map list,
this can prevent the wrong access on the freed map data.

Date: Dec 22, 2017
Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c

index 43df251..2ae5f21 100644 (file)
@@ -242,11 +242,6 @@ _DestroyMdl(
             allocator->ops->Free(allocator, Mdl);
         }
 
-        list_for_each_entry_safe(mdlMap, next, &Mdl->mapsHead, link)
-        {
-            gcmkVERIFY_OK(_DestroyMdlMap(Mdl, mdlMap));
-        }
-
         if (Mdl->link.next)
         {
             /* Remove the node from global list.. */
@@ -255,6 +250,11 @@ _DestroyMdl(
             mutex_unlock(&os->mdlMutex);
         }
 
+        list_for_each_entry_safe(mdlMap, next, &Mdl->mapsHead, link)
+        {
+            gcmkVERIFY_OK(_DestroyMdlMap(Mdl, mdlMap));
+        }
+
         kfree(Mdl);
     }