All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: vkoul@kernel.org, perex@perex.cz, tiwai@suse.com,
	pierre-louis.bossart@linux.dev, linux-sound@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 0/4] ALSA: compress: fix buffer handling and state validation
Date: Tue, 20 Oct 2026 10:48:15 +0200	[thread overview]
Message-ID: <87bj8oiwq8.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261019144533.30665-1-peter.ujfalusi@linux.intel.com>

On Mon, 19 Oct 2026 16:45:29 +0200,
Peter Ujfalusi wrote:
> 
> Hi,
> 
> Changes since v1:
> - patch 1: do not free the old buffer in snd_compr_allocate_buffer().
>   SET_PARAMS can only be repeated in OPEN state after ops->set_params()
>   has failed, so release the framework-owned buffer on that error path
>   instead. The buffer is allocated once per successful SET_PARAMS and is
>   never replaced (Vinod, Takashi)
> - patch 2: reworded the commit message: the buffer is set up once and the
>   next_track path does not re-allocate it. The geometry check is kept
>   because ops->set_params() would otherwise receive buffer parameters
>   that do not match the buffer in use. tinycompress always passes the
>   open-time fragment_size/fragments on next_track, so existing users are
>   not affected (Vinod)
> - patches 3 and 4: added Acked-by from Vinod
> 
> The compress offload core has several edge cases in buffer management
> and state validation.
> 
> A SET_PARAMS that the driver rejects leaves the framework-owned buffer
> allocated while the stream stays in the OPEN state, so a following
> SET_PARAMS overwrites the pointer and leaks the buffer. During gapless
> playback, SET_PARAMS can also change the buffer geometry while the byte
> counters still refer to the current buffer. Separately, SET_METADATA can
> reach the driver before SET_PARAMS, and the origin_seqno task lookup can
> restart a task that is still ACTIVE.
> 
> Address these cases by:
> - releasing the framework-owned buffer when ops->set_params() fails, so
>   the buffer is allocated once per successful SET_PARAMS;
> - not re-allocating the buffer on the gapless next_track path and
>   rejecting a buffer geometry change there;
> - rejecting SET_METADATA while the stream is OPEN; and
> - allowing origin_seqno to reuse IDLE or FINISHED tasks, but not ACTIVE
>   ones.
> 
> Regards,
> Peter
> ---
> Peter Ujfalusi (4):
>   ALSA: compress: fix buffer leak on failed SET_PARAMS
>   ALSA: compress: reject buffer geometry change on gapless next_track
>   ALSA: compress: add missing OPEN-state gate to SET_METADATA
>   ALSA: compress: reject restarting an ACTIVE task via origin_seqno

Applied all four patches now.  Thanks.


Takashi

      parent reply	other threads:[~2026-10-20  8:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 14:45 [PATCH v2 0/4] ALSA: compress: fix buffer handling and state validation Peter Ujfalusi
2026-10-19 14:45 ` [PATCH v2 1/4] ALSA: compress: fix buffer leak on failed SET_PARAMS Peter Ujfalusi
2026-10-19 14:45 ` [PATCH v2 2/4] ALSA: compress: reject buffer geometry change on gapless next_track Peter Ujfalusi
2026-10-19 14:45 ` [PATCH v2 3/4] ALSA: compress: add missing OPEN-state gate to SET_METADATA Peter Ujfalusi
2026-10-19 14:45 ` [PATCH v2 4/4] ALSA: compress: reject restarting an ACTIVE task via origin_seqno Peter Ujfalusi
2026-10-20  8:48 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bj8oiwq8.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.