[alsa-devel] [PATCH v3 4/8] ASoC: wm_adsp: Add support for opening a compressed stream

Mark Brown broonie at kernel.org
Wed Dec 23 01:14:56 CET 2015


On Tue, Dec 15, 2015 at 11:29:45AM +0000, Charles Keepax wrote:

> +int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream)
> +{
> +	struct wm_adsp_compr *compr;
> +	int ret = 0;
> +
> +	mutex_lock(&dsp->pwr_lock);
> +
> +	if (wm_adsp_fw[dsp->fw].num_caps == 0) {
> +		adsp_err(dsp, "Firmware does not support compressed API\n");
> +		ret = -ENXIO;
> +		goto out;
> +	}
> +
> +	if (wm_adsp_fw[dsp->fw].compr_direction != stream->direction) {
> +		adsp_err(dsp, "Firmware does not support stream direction\n");
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	compr = kzalloc(sizeof(*compr), GFP_KERNEL);

You're doing this under lock but not checking for an attempt to allocate
on a DSP already in use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20151223/72300b98/attachment.sig>


More information about the Alsa-devel mailing list