Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Hao Ge <hao.ge@linux.dev>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] ALSA: pcm: derive the audio timestamp for the DEFAULT type
Date: Thu, 03 Dec 2026 12:36:11 +0100	[thread overview]
Message-ID: <87ecbyvbo4.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261203100109.170640-1-hao.ge@linux.dev>

On Thu, 03 Dec 2026 11:01:09 +0100,
Hao Ge wrote:
> 
> snd_pcm_update_hw_ptr0() calls ->get_time_info() only when
> audio_tstamp_config.type_requested is not DEFAULT, while
> update_audio_tstamp() derives the timestamp from the buffer position
> only when audio_tstamp_report.actual_type is DEFAULT. The two
> conditions do not line up for a stream that requests the DEFAULT
> type. The callback is never called for such a stream, so actual_type
> stays at SNDRV_PCM_AUDIO_TSTAMP_TYPE_COMPAT, the zero value a
> kzalloc'ed runtime starts with, and update_audio_tstamp() reads the
> local audio_tstamp that was never written. This path never reaches a
> driver, so it cannot be fixed driver-side.
> 
>   BUG: KMSAN: uninit-value in update_audio_tstamp+0x728/0x880 [snd_pcm]
>    update_audio_tstamp+0x728/0x880 [snd_pcm]
>    snd_pcm_update_hw_ptr0+0x189c/0x1c50 [snd_pcm]
>    snd_pcm_delay+0x258/0x890 [snd_pcm]
>    snd_pcm_common_ioctl+0x2ef/0xbc0 [snd_pcm]
>    snd_pcm_ioctl+0x72/0xd0 [snd_pcm]
>    __se_sys_ioctl+0x1be/0x340
>    do_syscall_64+0x138/0x4b0
>    entry_SYSCALL_64_after_hwframe+0x76/0x7e
>   Local variable audio_tstamp created at:
>    snd_pcm_update_hw_ptr0+0x9f/0x1c50 [snd_pcm]
> 
> The reports come from a PipeWire stream querying
> SNDRV_PCM_IOCTL_DELAY and SNDRV_PCM_IOCTL_STATUS64, and from the
> period elapsed interrupt.
> 
> Also take the requested type into account in
> update_audio_tstamp(), and derive the timestamp from the buffer
> position when the caller asked for DEFAULT, which is what the type
> means.
> 
> Fixes: 3179f6200188 ("ALSA: core: add .get_time_info")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hao Ge <hao.ge@linux.dev>

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-12-03 11:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 10:01 [PATCH v2] ALSA: pcm: derive the audio timestamp for the DEFAULT type Hao Ge
2026-12-03 11:36 ` 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=87ecbyvbo4.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=hao.ge@linux.dev \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox