ASoC: Intel: Fix audio crash due to race condition in stream deletion
authorWenkai Du <wenkai.du@intel.com>
Wed, 23 Apr 2014 10:29:30 +0000 (13:29 +0300)
committerMark Brown <broonie@linaro.org>
Wed, 23 Apr 2014 11:11:20 +0000 (12:11 +0100)
commitd132cb0a162fa55c82e06b771fcaa871d30c9398
tree73bb32ad7e94188caf7ecbc992a3eb6b12eefdba
parent95e9ee92e20162681e9f65c25962e0606db9d149
ASoC: Intel: Fix audio crash due to race condition in stream deletion

There is a race between sst_byt_stream_free() and sst_byt_get_stream()
if sst_byt_get_stream() called from sst_byt_irq_thread() context is
accessing the byt->stream_list while a stream is deleted from the list.

A stream is added to byt->stream_list in sst_byt_stream_new() and deleted in
sst_byt_stream_free(). sst_byt_get_stream() is always protected by
sst->spinlock, but the stream addition and deletion are not protected.

The patch adds spinlock to both stream addition and deletion.

[Jarkko: Same fix added to sst-haswell-ipc.c too]

Signed-off-by: Wenkai Du <wenkai.du@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/intel/sst-baytrail-ipc.c
sound/soc/intel/sst-haswell-ipc.c