[media] cx18: Fix a sleep-in-atomic bug in snd_cx18_pcm_hw_free
commita3dbff6eecad72333bae656681331aab27adee4d
authorJia-Ju Bai <baijiaju1990@163.com>
Thu, 1 Jun 2017 07:17:51 +0000 (1 04:17 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 7 Jun 2017 15:28:50 +0000 (7 12:28 -0300)
tree8d45015d2cc3f36ca0f76e68571e3f831aa132cf
parentd989dc20c508cd82e2a95ff5d6c4bb091803f1c8
[media] cx18: Fix a sleep-in-atomic bug in snd_cx18_pcm_hw_free

The driver may sleep under a spin lock, and the function call path is:
snd_cx18_pcm_hw_free (acquire the lock by spin_lock_irqsave)
  vfree --> may sleep

To fix it, the "substream->runtime->dma_area" is passed to a temporary
value, and mark it NULL when holding the lock. The memory is freed by
vfree through the temporary value outside the lock holding.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
[hans.verkuil@cisco.com: removed unnecessary 'if (dma_area)']
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/cx18/cx18-alsa-pcm.c