Skip to content

Commit 7439b39

Browse files
Al Virotiwai
authored andcommitted
ALSA: compress_offload: fix remaining descriptor races in sound/core/compress_offload.c
3d3f43f ("ALSA: compress_offload: improve file descriptors installation for dma-buf") fixed some of descriptor races in snd_compr_task_new(), but there's a couple more left. We need to grab the references to dmabuf before moving them into descriptor table - trying to do that by descriptor afterwards might end up getting a different object, with a dangling reference left in task->{input,output} Fixes: 3d3f43f ("ALSA: compress_offload: improve file descriptors installation for dma-buf") Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://patch.msgid.link/20241229185232.GA1977892@ZenIV Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ac9fae7 commit 7439b39

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/core/compress_offload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,13 +1053,13 @@ static int snd_compr_task_new(struct snd_compr_stream *stream, struct snd_compr_
10531053
put_unused_fd(fd_i);
10541054
goto cleanup;
10551055
}
1056+
/* keep dmabuf reference until freed with task free ioctl */
1057+
get_dma_buf(task->input);
1058+
get_dma_buf(task->output);
10561059
fd_install(fd_i, task->input->file);
10571060
fd_install(fd_o, task->output->file);
10581061
utask->input_fd = fd_i;
10591062
utask->output_fd = fd_o;
1060-
/* keep dmabuf reference until freed with task free ioctl */
1061-
dma_buf_get(utask->input_fd);
1062-
dma_buf_get(utask->output_fd);
10631063
list_add_tail(&task->list, &stream->runtime->tasks);
10641064
stream->runtime->total_tasks++;
10651065
return 0;

0 commit comments

Comments
 (0)