dsp: add mutex unlock to properly release lock
Add mutex unlock in function audio_effects_shared_ioctl at appropriate place to prevent use after free. CRs-Fixed: 2123291 Change-Id: Ie0d321dc8cc20a295d102a44faea7e5710834932 Signed-off-by: Tanya Dixit <tdixit@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
7cb56be566
commit
f415b42910
@@ -161,7 +161,6 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned int cmd,
|
|||||||
pr_err("%s: Read buffer Allocation failed rc = %d\n",
|
pr_err("%s: Read buffer Allocation failed rc = %d\n",
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
mutex_unlock(&effects->lock);
|
|
||||||
goto readbuf_fail;
|
goto readbuf_fail;
|
||||||
}
|
}
|
||||||
atomic_set(&effects->out_count, effects->config.output.num_buf);
|
atomic_set(&effects->out_count, effects->config.output.num_buf);
|
||||||
@@ -176,7 +175,6 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned int cmd,
|
|||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
pr_err("%s: pcm read block config failed\n", __func__);
|
pr_err("%s: pcm read block config failed\n", __func__);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
mutex_unlock(&effects->lock);
|
|
||||||
goto cfg_fail;
|
goto cfg_fail;
|
||||||
}
|
}
|
||||||
pr_debug("%s: dec: sample_rate: %d, num_channels: %d, bit_width: %d\n",
|
pr_debug("%s: dec: sample_rate: %d, num_channels: %d, bit_width: %d\n",
|
||||||
@@ -191,7 +189,6 @@ static int audio_effects_shared_ioctl(struct file *file, unsigned int cmd,
|
|||||||
pr_err("%s: pcm write format block config failed\n",
|
pr_err("%s: pcm write format block config failed\n",
|
||||||
__func__);
|
__func__);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
mutex_unlock(&effects->lock);
|
|
||||||
goto cfg_fail;
|
goto cfg_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,6 +322,7 @@ ioctl_fail:
|
|||||||
readbuf_fail:
|
readbuf_fail:
|
||||||
q6asm_audio_client_buf_free_contiguous(IN,
|
q6asm_audio_client_buf_free_contiguous(IN,
|
||||||
effects->ac);
|
effects->ac);
|
||||||
|
mutex_unlock(&effects->lock);
|
||||||
return rc;
|
return rc;
|
||||||
cfg_fail:
|
cfg_fail:
|
||||||
q6asm_audio_client_buf_free_contiguous(IN,
|
q6asm_audio_client_buf_free_contiguous(IN,
|
||||||
@@ -332,6 +330,7 @@ cfg_fail:
|
|||||||
q6asm_audio_client_buf_free_contiguous(OUT,
|
q6asm_audio_client_buf_free_contiguous(OUT,
|
||||||
effects->ac);
|
effects->ac);
|
||||||
effects->buf_alloc = 0;
|
effects->buf_alloc = 0;
|
||||||
|
mutex_unlock(&effects->lock);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user