umber-kernel/sound
Nathan Chancellor b9f13e5516 ALSA: pcm: Revert bufs move in snd_pcm_xfern_frames_ioctl()
[ Upstream commit 0585c53b21541cd6b17ad5ab41b371a0d52e358c ]

When building with clang older than 17 targeting architectures that use
asm goto for their get_user() and put_user(), such as arm64, after
commit f3d233daf011 ("ALSA: pcm: Relax __free() variable declarations"),
there are bogus errors around skipping over a variable declared with the
cleanup attribute:

  sound/core/pcm_native.c:3308:6: error: cannot jump from this asm goto statement to one of its possible targets
          if (put_user(result, &_xfern->result))
              ^
  ...
  arch/arm64/include/asm/uaccess.h:298:2: note: expanded from macro '__put_mem_asm'
          asm goto(
          ^
  sound/core/pcm_native.c:3295:6: note: possible target of asm goto statement
          if (put_user(0, &_xfern->result))
              ^
  ...
  sound/core/pcm_native.c:3300:8: note: jump exits scope of variable with __attribute__((cleanup))
          void *bufs __free(kfree) =
                ^

clang-17 fixed a bug in clang's jump scope checker [1] where all labels
in a function were checked as valid targets for all asm goto instances
in a function, regardless of whether they were actual targets in a
paricular asm goto's provided list of labels.

To workaround this, revert the change done to
snd_pcm_xfern_frames_ioctl() by commit f3d233daf011 ("ALSA: pcm: Relax
__free() variable declarations") to avoid a variable declared with
cleanup from existing between multiple uses of asm goto. There are no
other uses of cleanup in this function so there should be low risk from
moving this variable back to the top of the function.

Link: https://github.com/ClangBuiltLinux/linux/issues/1886 [1]
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512190802.i4Jzbcsl-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20260106-pcm_native-revert-var-move-free-for-old-clang-v1-1-06a03693423d@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-03-04 07:21:35 -05:00
..
ac97 ALSA: ac97: fix a double free in snd_ac97_controller_register() 2026-01-17 16:35:12 +01:00
aoa
arm
atmel
core ALSA: pcm: Revert bufs move in snd_pcm_xfern_frames_ioctl() 2026-03-04 07:21:35 -05:00
drivers ALSA: aloop: Fix racy access at PCM trigger 2026-02-11 13:41:41 +01:00
firewire ALSA: dice: fix buffer overflow in detect_stream_formats() 2025-12-18 14:03:42 +01:00
hda ALSA: hda/hdmi: Add quirk for TUXEDO IBS14G6 2026-03-04 07:20:42 -05:00
i2c
isa ALSA: wavefront: Fix integer overflow in sample size validation 2025-12-18 14:03:43 +01:00
mips
oss
parisc
pci ALSA: ctxfi: Fix potential OOB access in audio mixer handling 2026-01-30 10:32:23 +01:00
pcmcia ALSA: pcmcia: Fix resource leak in snd_pdacf_probe error path 2026-01-02 12:56:58 +01:00
ppc
sh
soc ASoC: amd: yc: Add DMI quirk for ASUS Vivobook Pro 15X M6501RR 2026-03-04 07:21:32 -05:00
sparc
spi
synth
usb ALSA: usb-audio: Add sanity check for OOB writes at silencing 2026-03-04 07:20:42 -05:00
virtio
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c