drm/tgm: fix deadlock issue 22/176922/1 accepted/tizen/unified/20180424.165728 submit/tizen/20180424.080322
authorInki Dae <inki.dae@samsung.com>
Tue, 24 Apr 2018 06:09:19 +0000 (15:09 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 24 Apr 2018 07:30:00 +0000 (16:30 +0900)
Fixed a deadlock issue on mem_lock of tdm pp driver.

The deadlock could happen when pp_start_property function
is called at the funciton which already taken a mem_lock
because pp_start_property takes the mem_lock internally
so this patch makes the mem_lock to be unlocked before
pp_start_property funciton is called.

Change-Id: Icde3999a978252c00d845fd0a954cf5d3298397a
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/tgm/tdm_pp.c

index 2b17d97de61b70b86395a8b82e761fc4a41600c4..d89af02d559f49bcabeffc70a63bf8fb017f435c 100644 (file)
@@ -954,6 +954,7 @@ static int pp_queue_buf_with_run(struct device *dev,
                        cmd_work->ctrl = PP_CTRL_PLAY;
                        pp_handle_cmd_work(dev, ppdrv, cmd_work, c_node);
                } else {
+                       mutex_unlock(&c_node->mem_lock);
                        mutex_lock(&ppdrv->drv_lock);
 
                        ret = pp_start_property(ppdrv, c_node);
@@ -964,6 +965,7 @@ static int pp_queue_buf_with_run(struct device *dev,
                        }
 
                        mutex_unlock(&ppdrv->drv_lock);
+                       mutex_lock(&c_node->mem_lock);
                }
        } else {
                ret = pp_set_mem_node(ppdrv, c_node, m_node);