ALSA: compress_offload: use safe list iteration in snd_compr_task_seq()
Subsystems (2)
Jaroslav Kysela
maintainerPATCH 1/1 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.
Fixes 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
Reported-by Dan Carpenter <[email protected]>
Cc Vinod Koul <[email protected]>
Signed-off-by Jaroslav Kysela <[email protected]>
--- sound/core/compress_offload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/compress_offload.c +2 -2
@@ -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 argreturn retval; 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);
Signature · 1 line
2.47.0
Quoted 10 lines · Jaroslav Kysela
The sequence function can call
snd_compr_task_free_one(). Uselist_for_each_entry_safe_reverse()to make sure that the used pointers are safe.Fixes 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")Reported-by Dan Carpenter <[email protected]>Cc Vinod Koul <[email protected]>Signed-off-by Jaroslav Kysela <[email protected]>
Applied now. Thanks.
Takashi