From eeb07bf4c81fdfb20622ac79d733434aeb4cdcb7 Mon Sep 17 00:00:00 2001 From: apollo.ling Date: Tue, 05 Nov 2019 08:16:15 +0000 Subject: media_module: fix the call sequence of del_timer_sync and cancel_work_sync [1/1] PD#SWPL-16242 Problem: {stresstest} {KASAN} avs bug causes system crash when do DTV 2s channel switch and 15s suspend.(1/6,none) Solution: correct the call sequence of del_timer_sync and cancel_work_sync Verify: X301 Change-Id: I53534f207d3379fe6e463ae2e57badeceeb5f9ec Signed-off-by: apollo.ling --- diff --git a/drivers/frame_provider/decoder/avs/avs.c b/drivers/frame_provider/decoder/avs/avs.c index 5d85fb9..642c3bb 100644 --- a/drivers/frame_provider/decoder/avs/avs.c +++ b/drivers/frame_provider/decoder/avs/avs.c @@ -1722,6 +1722,10 @@ static int amvdec_avs_probe(struct platform_device *pdev) static int amvdec_avs_remove(struct platform_device *pdev) { + if (stat & STAT_TIMER_ARM) { + del_timer_sync(&recycle_timer); + stat &= ~STAT_TIMER_ARM; + } cancel_work_sync(&fatal_error_wd_work); atomic_set(&error_handler_run, 0); @@ -1738,10 +1742,6 @@ static int amvdec_avs_remove(struct platform_device *pdev) stat &= ~STAT_ISR_REG; } - if (stat & STAT_TIMER_ARM) { - del_timer_sync(&recycle_timer); - stat &= ~STAT_TIMER_ARM; - } #ifdef AVSP_LONG_CABAC if (firmware_sel == 0) { mutex_lock(&vavs_mutex); -- cgit