MLK-21144 ASoC: fsl: Fix crash with multiple open/close
authorDaniel Baluta <daniel.baluta@nxp.com>
Wed, 27 Mar 2019 08:25:22 +0000 (10:25 +0200)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 18 Apr 2019 00:00:38 +0000 (03:00 +0300)
commit2cdfa98a11d9bc7e58eb628a5ed7abdc446a07ac
tree53910e16e17f8765eb7afde22898291f88368b63
parent6fdc235c901f2574c02c4eaeafdb6f9ceb40913a
MLK-21144 ASoC: fsl: Fix crash with multiple open/close

Because we are re-initializing the proxy at close it might
happen that work is still pending which causes the following crash:

[   94.699835] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   94.707923] Mem abort info:
[   94.710722]   Exception class = DABT (current EL), IL = 32 bits
[   94.716637]   SET = 0, FnV = 0
[   94.719686]   EA = 0, S1PTW = 0
[   94.722822] Data abort info:
[   94.725698]   ISV = 0, ISS = 0x00000005
[   94.729530]   CM = 0, WnR = 0
[   94.732504] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008d9ba3000
[   94.739035] [0000000000000008] *pgd=0000000938419003, *pud=0000000000000000
[   94.746015] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   94.751589] Modules linked in:
[   94.754652] CPU: 0 PID: 2068 Comm: kworker/0:2 Not tainted 4.14.98-dirty #75
[   94.761700] Hardware name: Freescale i.MX8QM MEK (DT)
[   94.766768] task: ffff8008f23ae200 task.stack: ffff000014378000
[   94.772705] PC is at process_one_work+0x34/0x414
[   94.777325] LR is at process_one_work+0x1e0/0x414

In order to fix this, we make sure that no work is pending before starting
the re-initialization.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit 2c00c24be5f8b63636e3f9005e15a3de42058438)
sound/soc/fsl/fsl_dsp.c