media: fimc-is2: fix vfree() in atomic context
authorCho KyongHo <pullip.cho@samsung.com>
Fri, 23 Feb 2018 02:04:54 +0000 (11:04 +0900)
committerEunyoung Lee <ey470.lee@samsung.com>
Tue, 19 Jun 2018 08:43:37 +0000 (17:43 +0900)
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: [<ffffff80086dc168>] fimc_is_spin_lock_ir
Preemption disabled at:
[<ffffff80086dc168>] 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:
[<ffffff800808ca74>] dump_backtrace+0x0/0x458
[<ffffff800808cee0>] show_stack+0x14/0x1c
[<ffffff800897ef7c>] dump_stack+0x84/0xac
[<ffffff80080d81dc>] ___might_sleep+0x14c/0x16c
[<ffffff80080d826c>] __might_sleep+0x70/0x80
[<ffffff80081eb158>] remove_vm_area+0x28/0x9c
[<ffffff80081eb274>] __vunmap+0xa8/0xcc
[<ffffff80081eb368>] vfree+0x7c/0x84
[<ffffff80086db09c>] fimc_is_spin_lock_finish+0x160/0x18c
[<ffffff80fa090778>] 0xffffff80fa090778
[<ffffff80fa0af4e8>] 0xffffff80fa0af4e8
[<ffffff80fa175e3c>] 0xffffff80fa175e3c
[<ffffff80fa1764e8>] 0xffffff80fa1764e8
[<ffffff80fa13f8a0>] 0xffffff80fa13f8a0
[<ffffff80fa152500>] 0xffffff80fa152500
[<ffffff80fa15255c>] 0xffffff80fa15255c
[<ffffff80fa13da28>] 0xffffff80fa13da28
[<ffffff80fa09176c>] 0xffffff80fa09176c
[<ffffff80fa09da80>] 0xffffff80fa09da80
[<ffffff80fa08eae0>] 0xffffff80fa08eae0
[<ffffff80086e1d50>] fimc_is_lib_isp_object_destroy+0x90/0xd4
[<ffffff80086c32a0>] fimc_is_hw_isp_deinit+0x34/0x50
[<ffffff80086be1e0>] fimc_is_hardware_close+0x140/0x39c
[<ffffff800868db8c>] fimc_is_itf_close_wrap+0x1dc/0x228
[<ffffff80086858ac>] fimc_is_ischain_close_wrap+0x248/0x2dc
[<ffffff80086889ac>] fimc_is_ischain_vra_close+0x18c/0x1f0
[<ffffff8008677090>] fimc_is_vra_video_close+0x50/0x158
[<ffffff80085edfb4>] v4l2_release+0x38/0x7c
[<ffffff8008203d68>] __fput+0xf4/0x1b8
[<ffffff8008203e88>] ____fput+0xc/0x14
[<ffffff80080cbee8>] task_work_run+0x90/0xbc
[<ffffff800808c480>] do_notify_resume+0xe4/0xf0

Change-Id: Ic9b80afe4ef531871d9347f45e35eaed5ac18d76
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/media/platform/exynos/fimc-is2/interface/fimc-is-interface-library.c

index 0069f85c9b2c9690f2fbd13117643a1796ca9cf6..e2531ebfc515e53689e82e216ac79eac2b70fa31 100644 (file)
@@ -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;
 }