ASoC: STI: Fix null ptr deference in IRQ handler
authorArnaud Pouliquen <arnaud.pouliquen@st.com>
Tue, 28 Mar 2017 13:04:55 +0000 (15:04 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 6 Apr 2017 18:29:07 +0000 (19:29 +0100)
commitd05d862ead8eca5e7d4ccf82d39d9189579ee5b1
treedf3ed6ade1621328947ef5f94e3d553aa73b9d58
parent3c9d3f1bc2defd418b5933bbc928096c9c686d3b
ASoC: STI: Fix null ptr deference in IRQ handler

With RTlinux a race condition has been found that leads to NULL ptr crash:
- On CPU 0: uni_player_irq_handler is called to treat XRUN
 "(player->state == UNIPERIF_STATE_STOPPED)" is FALSE so status is checked,
 dev_err(player->dev, "FIFO underflow error detected") is printed
and then snd_pcm_stream_lock should be called to lock stream for stopping.
- On CPU 1: application stop and close the stream.
Issue is that the stop and shutdown functions are executed while
"FIFO underflow error detected" is printed.
So when CPU 0 calls snd_pcm_stream_lock, player->substream is already null.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sti/uniperif.h
sound/soc/sti/uniperif_player.c
sound/soc/sti/uniperif_reader.c