• Arnaud Pouliquen's avatar
    ASoC: STI: Fix null ptr deference in IRQ handler · d05d862e
    Arnaud Pouliquen authored
    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: default avatarArnaud Pouliquen <arnaud.pouliquen@st.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    d05d862e
uniperif_player.c 31.3 KB