mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
ALSA: compress_offload: use safe list iteration in snd_compr_task_seq()
The sequence function can call snd_compr_task_free_one(). Use
list_for_each_entry_safe_reverse() to make sure that the used
pointers are safe.
Link: https://lore.kernel.org/linux-sound/f2769cff-6c7a-4092-a2d1-c33a5411a182@stanley.mountain/
Fixes: 04177158cf
("ALSA: compress_offload: introduce accel operation mode")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20241217100707.732766-1-perex@perex.cz
This commit is contained in:
parent
6018f2fe10
commit
f25a51b47c
@ -1174,7 +1174,7 @@ typedef void (*snd_compr_seq_func_t)(struct snd_compr_stream *stream,
|
||||
static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg,
|
||||
snd_compr_seq_func_t fcn)
|
||||
{
|
||||
struct snd_compr_task_runtime *task;
|
||||
struct snd_compr_task_runtime *task, *temp;
|
||||
__u64 seqno;
|
||||
int retval;
|
||||
|
||||
@ -1185,7 +1185,7 @@ static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg
|
||||
return -EFAULT;
|
||||
retval = 0;
|
||||
if (seqno == 0) {
|
||||
list_for_each_entry_reverse(task, &stream->runtime->tasks, list)
|
||||
list_for_each_entry_safe_reverse(task, temp, &stream->runtime->tasks, list)
|
||||
fcn(stream, task);
|
||||
} else {
|
||||
task = snd_compr_find_task(stream, seqno);
|
||||
|
Loading…
Reference in New Issue
Block a user