]> git.hungrycats.org Git - linux/commit
ALSA: compress: Fix task creation error unwind
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Mon, 15 Jun 2026 13:37:26 +0000 (10:37 -0300)
committerTakashi Iwai <tiwai@suse.de>
Wed, 17 Jun 2026 09:04:10 +0000 (11:04 +0200)
commit4a60127debb9e370d6c0e22a307326b624a141f3
treec717ef654a484e461fd8be3e74e8d15644aa422b
parentc5e90e8844692deb7bbcd029e8b92b3a20441903
ALSA: compress: Fix task creation error unwind

snd_compr_task_new() allocates the driver task before validating the
returned DMA buffers and reserving file descriptors. When either of
those later steps fails, the core frees its task wrapper and DMA-buffer
references without calling the driver's task_free() callback. Any
driver resources allocated by task_create() are therefore leaked.

The dual-fd allocation path also jumps to cleanup without storing the
negative get_unused_fd_flags() result in retval. Since retval still
contains the successful task_create() return value, TASK_CREATE can
incorrectly report success although the task was discarded.

Preserve the fd allocation errors and call task_free() when failure
occurs after a successful task_create() callback.

Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
Fixes: 3d3f43fab4cf ("ALSA: compress_offload: improve file descriptors installation for dma-buf")
Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260615-alsa-compress-task-unwind-v1-1-39e8ad3ddb27@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c