From 32a0dc57480f2380e3f3c6bdb841e972eae265b0 Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Fri, 23 Feb 2018 11:04:54 +0900 Subject: [PATCH] media: fimc-is2: fix vfree() in atomic context vfree() called in fimc_is_spin_lock_finish() works in an atomic context created by spinlock. BUG: sleeping function called from invalid context at mm/vmalloc.c:1490 in_atomic(): 1, irqs_disabled(): 128, pid: 3172, name: provider@2.4-se 1 lock held by provider@2.4-se/3172: #0: (&((spinlock_t *)*slock)->rlock){....}, at: [] fimc_is_spin_lock_ir Preemption disabled at: [] fimc_is_spin_lock_irqsave+0x14/0x1c CPU: 4 PID: 3172 Comm: provider@2.4-se Tainted: G W 4.14.20-g90d0e51-dirty #45 Hardware name: Samsung UNIVERSAL9810-2-rev02 board based on EXYNOS9810 (DT) Call trace: [] dump_backtrace+0x0/0x458 [] show_stack+0x14/0x1c [] dump_stack+0x84/0xac [] ___might_sleep+0x14c/0x16c [] __might_sleep+0x70/0x80 [] remove_vm_area+0x28/0x9c [] __vunmap+0xa8/0xcc [] vfree+0x7c/0x84 [] fimc_is_spin_lock_finish+0x160/0x18c [] 0xffffff80fa090778 [] 0xffffff80fa0af4e8 [] 0xffffff80fa175e3c [] 0xffffff80fa1764e8 [] 0xffffff80fa13f8a0 [] 0xffffff80fa152500 [] 0xffffff80fa15255c [] 0xffffff80fa13da28 [] 0xffffff80fa09176c [] 0xffffff80fa09da80 [] 0xffffff80fa08eae0 [] fimc_is_lib_isp_object_destroy+0x90/0xd4 [] fimc_is_hw_isp_deinit+0x34/0x50 [] fimc_is_hardware_close+0x140/0x39c [] fimc_is_itf_close_wrap+0x1dc/0x228 [] fimc_is_ischain_close_wrap+0x248/0x2dc [] fimc_is_ischain_vra_close+0x18c/0x1f0 [] fimc_is_vra_video_close+0x50/0x158 [] v4l2_release+0x38/0x7c [] __fput+0xf4/0x1b8 [] ____fput+0xc/0x14 [] task_work_run+0x90/0xbc [] do_notify_resume+0xe4/0xf0 Change-Id: Ic9b80afe4ef531871d9347f45e35eaed5ac18d76 Signed-off-by: Cho KyongHo --- .../exynos/fimc-is2/interface/fimc-is-interface-library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos/fimc-is2/interface/fimc-is-interface-library.c b/drivers/media/platform/exynos/fimc-is2/interface/fimc-is-interface-library.c index 0069f85c9b2c..e2531ebfc515 100644 --- a/drivers/media/platform/exynos/fimc-is2/interface/fimc-is-interface-library.c +++ b/drivers/media/platform/exynos/fimc-is2/interface/fimc-is-interface-library.c @@ -1319,7 +1319,7 @@ int fimc_is_spin_lock_finish(void *slock_lib) #ifdef LIB_MEM_TRACK add_free_track(MT_TYPE_SPINLOCK, (ulong)slock_lib); #endif - vfree(slock_lib); + vfree_atomic(slock_lib); return 0; } -- 2.20.1