linux-stable/include/sound
Takashi Iwai c1f6e3c818 ALSA: rawmidi: Fix racy buffer resize under concurrent accesses
The rawmidi core allows user to resize the runtime buffer via ioctl,
and this may lead to UAF when performed during concurrent reads or
writes: the read/write functions unlock the runtime lock temporarily
during copying form/to user-space, and that's the race window.

This patch fixes the hole by introducing a reference counter for the
runtime buffer read/write access and returns -EBUSY error when the
resize is performed concurrently against read/write.

Note that the ref count field is a simple integer instead of
refcount_t here, since the all contexts accessing the buffer is
basically protected with a spinlock, hence we need no expensive atomic
ops.  Also, note that this busy check is needed only against read /
write functions, and not in receive/transmit callbacks; the race can
happen only at the spinlock hole mentioned in the above, while the
whole function is protected for receive / transmit callbacks.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CAFcO6XMWpUVK_yzzCpp8_XP7+=oUpQvuBeCbMffEDkpe8jWrfg@mail.gmail.com
Link: https://lore.kernel.org/r/s5heerw3r5z.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-07 22:29:14 +02:00
..
ac97
sof ASoC: SOF: IPC: dai-intel: move ALH declarations in header file 2020-03-27 15:16:30 +00:00
ac97_codec.h ALSA: ac97: Treat snd_ac97_bus_ops as const 2020-01-03 09:24:08 +01:00
aci.h
ad1816a.h
ad1843.h
adau1373.h
ak4xxx-adda.h
ak4113.h
ak4114.h
ak4117.h
ak4531_codec.h
ak4641.h
alc5623.h
asequencer.h
asound.h
asoundef.h
compress_driver.h ALSA: core: Implement compress page allocation and free routines 2020-02-18 21:52:05 +00:00
control.h ALSA: control: Add verification for kctl accesses 2020-01-04 09:37:59 +01:00
core.h ALSA: core: Add snd_device_get_state() helper 2020-03-23 18:09:19 +01:00
cs35l33.h
cs35l34.h
cs35l35.h
cs35l36.h
cs42l52.h
cs42l56.h
cs42l73.h
cs4231-regs.h
cs4271.h
cs8403.h
cs8427.h
da7213.h
da7218.h
da7219-aad.h
da7219.h
da9055.h
designware_i2s.h
dmaengine_pcm.h ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparams 2019-10-01 12:18:25 +01:00
emu10k1.h
emu10k1_synth.h
emu8000.h
emu8000_reg.h
emux_legacy.h
emux_synth.h
es1688.h
gus.h
hda_chmap.h
hda_codec.h ALSA: hda: Skip controller resume if not needed 2020-04-13 18:03:16 +02:00
hda_component.h
hda_hwdep.h
hda_i915.h
hda_register.h ALSA: hdac: clear link output stream mapping 2019-10-07 03:58:48 +02:00
hda_regmap.h ALSA: hda: Manage concurrent reg access more properly 2020-01-13 13:40:41 +01:00
hda_verbs.h
hdaudio.h ASoC: SOF: Intel: Account for compress streams when servicing IRQs 2020-02-18 21:52:06 +00:00
hdaudio_ext.h
hdmi-codec.h ASoC: hdmi-codec: Add an op to set callback function for plug event 2019-09-09 14:50:03 +01:00
hwdep.h
i2c.h
info.h ALSA: info: Make snd_info_entry_ops as const 2020-01-03 09:24:18 +01:00
initval.h ALSA: Allow const arrays for legacy resource management helpers 2020-01-05 16:14:26 +01:00
intel-dsp-config.h ALSA: hda: add Intel DSP configuration / probe code 2019-10-23 06:31:37 +02:00
intel-nhlt.h
jack.h
l3.h
madera-pdata.h
max9768.h
max98088.h
max98090.h
max98095.h
memalloc.h ALSA: memalloc: Drop snd_dma_pci_data() macro 2019-11-11 09:14:07 +01:00
minors.h
mixer_oss.h
mpu401.h
omap-hdmi-audio.h
opl3.h
opl4.h
pcm-indirect.h
pcm.h ASoC: Updates for v5.7 2020-03-30 13:43:00 +02:00
pcm_drm_eld.h
pcm_iec958.h
pcm_oss.h
pcm_params.h ALSA: pcm: More helper macros for reducing snd_pcm_format_t cast 2020-02-10 08:27:08 +01:00
pt2258.h
pxa2xx-lib.h ASoC: pxa: remove snd_pcm_ops 2019-10-08 13:47:20 +01:00
rawmidi.h ALSA: rawmidi: Fix racy buffer resize under concurrent accesses 2020-05-07 22:29:14 +02:00
rt286.h
rt298.h
rt5514.h
rt5645.h
rt5659.h
rt5660.h
rt5663.h
rt5665.h
rt5668.h
rt5670.h
rt5682.h ASoC: rt5682: Add a property for DMIC delay 2020-03-23 18:17:24 +00:00
s3c24xx_uda134x.h
sb.h
sb16_csp.h
seq_device.h
seq_kernel.h
seq_midi_emul.h ALSA: seq: Constify struct snd_midi_op 2020-01-03 09:24:19 +01:00
seq_midi_event.h
seq_oss.h
seq_oss_legacy.h
seq_virmidi.h
sh_dac_audio.h
sh_fsi.h
simple_card.h
simple_card_utils.h Merge branch 'for-5.4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.5 2019-11-06 16:29:34 +00:00
snd_wavefront.h
soc-acpi-intel-match.h ASoC: Intel: common: soc-acpi: declare new tables for SoundWire 2020-01-13 15:00:37 +00:00
soc-acpi.h ASoC: soc-acpi: expand description of _ADR-based devices 2020-03-27 15:16:28 +00:00
soc-component.h ASoC: soc-pcm: fix state tracking error in snd_soc_component_open/close() 2020-02-24 21:48:24 +00:00
soc-dai.h ASoC: soc-dai: revert all changes to DAI startup/shutdown sequence 2020-04-15 23:06:01 +01:00
soc-dapm.h Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.7 2020-02-24 22:26:06 +00:00
soc-dpcm.h ASoC: export DPCM runtime update functions 2020-03-12 13:30:38 +00:00
soc-topology.h
soc.h ASoC: dapm: Fix regression introducing multiple copies of DAI widgets 2020-04-14 12:16:23 +01:00
sof.h ASoC: SOF: move arch_ops under ops 2019-12-18 20:02:02 +00:00
soundfont.h
spear_dma.h
spear_spdif.h
sta32x.h
sta350.h
tas2552-plat.h
tas5086.h
tea6330t.h
timer.h ALSA: Replace timespec with timespec64 2019-12-11 22:06:14 +01:00
tlv.h
tlv320aic3x.h
tlv320aic32x4.h
tlv320dac33-plat.h
tpa6130a2-plat.h
uda134x.h
uda1380.h
util_mem.h
vx_core.h ALSA: vx: Constify snd_vx_hardware and snd_vx_ops definitions 2020-01-03 09:24:20 +01:00
wavefront.h
wm0010.h
wm1250-ev1.h
wm2000.h
wm2200.h
wm5100.h
wm8903.h
wm8904.h ASoC: Spelling s/configr/configur/ 2019-10-25 11:06:57 +01:00
wm8955.h
wm8960.h
wm8962.h
wm8993.h
wm8996.h
wm9081.h
wm9090.h
wss.h