linux_dsm_epyc7002/sound/soc
Silvio Cesare c407cd008f
ASoC: imx-audmux: change snprintf to scnprintf for possible overflow
Change snprintf to scnprintf. There are generally two cases where using
snprintf causes problems.

1) Uses of size += snprintf(buf, SIZE - size, fmt, ...)
In this case, if snprintf would have written more characters than what the
buffer size (SIZE) is, then size will end up larger than SIZE. In later
uses of snprintf, SIZE - size will result in a negative number, leading
to problems. Note that size might already be too large by using
size = snprintf before the code reaches a case of size += snprintf.

2) If size is ultimately used as a length parameter for a copy back to user
space, then it will potentially allow for a buffer overflow and information
disclosure when size is greater than SIZE. When the size is used to index
the buffer directly, we can have memory corruption. This also means when
size = snprintf... is used, it may also cause problems since size may become
large.  Copying to userspace is mitigated by the HARDENED_USERCOPY kernel
configuration.

The solution to these issues is to use scnprintf which returns the number of
characters actually written to the buffer, so the size variable will never
exceed SIZE.

Signed-off-by: Silvio Cesare <silvio.cesare@gmail.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-15 19:06:08 +00:00
..
adi
amd ASoC: use dma_ops of parent device for acp_audio_dma 2018-12-06 12:55:28 +00:00
atmel ASoC: atmel: add SND_SOC_I2C_AND_SPI dependency 2018-09-27 23:22:40 +01:00
au1x treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
bcm ASoC: bcm: use devm_snd_soc_register_component() 2018-09-10 15:13:12 +01:00
cirrus ASoC: cirrus: i2s: IRQ-based stream watchdog 2018-05-11 11:27:33 +09:00
codecs ASoC: rt5514-spi: Fix potential NULL pointer dereference 2019-01-15 19:03:49 +00:00
dwc Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134', 'asoc/topic/es8316', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next 2018-03-28 10:29:36 +08:00
fsl ASoC: imx-audmux: change snprintf to scnprintf for possible overflow 2019-01-15 19:06:08 +00:00
generic ASoC: simple-card: tidyup prefix for snd_soc_codec_conf 2018-12-14 11:48:57 +00:00
hisilicon ASoC: hisilicon: fix fall-through annotations 2018-09-17 10:30:23 -07:00
img treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
intel ASoC: Intel: Boards: move the codec PLL configuration to _init 2019-01-09 19:26:47 +00:00
jz4740
kirkwood ASoC: Remove depends on HAS_DMA in case of platform dependency 2018-04-18 11:17:09 +01:00
mediatek ASoC: Convert a few more users to using %pOFn instead of device_node.name 2018-11-16 19:07:35 -08:00
meson ASoC: meson: fix do_div warning in spdifin 2018-12-13 16:20:28 +00:00
mxs Merge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/mxs', 'asoc/topic/mxs-sgtl5000', 'asoc/topic/nau8540' and 'asoc/topic/nau8824' into asoc-next 2018-01-26 15:27:22 +00:00
nuc900 ASoC: nuc900: use devm_snd_soc_register_component() 2018-09-10 15:14:14 +01:00
pxa ASoC: pxa: remove raumfeld machine driver 2018-12-03 15:28:29 +00:00
qcom ASoC: qdsp6: q6asm-dai: Fix a small memory leak 2019-01-03 16:32:56 +00:00
rockchip ASoC: rockchip: add missing slave_config setting for I2S 2018-11-13 10:06:23 -08:00
samsung ASoC: add for_each_card_prelinks() macro 2018-09-20 10:18:34 -07:00
sh ASoC: dma-sh7760: cleanup a debug printk 2019-01-03 16:32:48 +00:00
sirf ASoC: sirf: Fix potential NULL pointer dereference 2018-07-30 12:02:30 +01:00
spear
sti ASoC: sti: Use snd_pcm_stop_xrun() helper 2018-07-04 15:41:35 +01:00
stm ASoC: Convert a few more users to using %pOFn instead of device_node.name 2018-11-16 19:07:35 -08:00
sunxi Merge branch 'for-4.20' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-4.21 intel dep 2018-12-13 14:36:46 +00:00
tegra ASoC: tegra_sgtl5000: fix device_node refcounting 2018-10-17 19:51:22 +01:00
ti ASoC: ti: davinci-mcasp: Move context save/restore to runtime_pm callbacks 2019-01-04 15:18:42 +00:00
txx9 ASoC: txx9: use devm_snd_soc_register_component() 2018-09-10 15:14:47 +01:00
uniphier ASoC: uniphier: change functions to static 2018-07-30 12:02:32 +01:00
ux500 ASoC: ux500: add MODULE_LICENSE tag 2018-01-10 16:42:10 +00:00
xilinx ASoC: xlnx: change license header format style 2019-01-03 16:32:51 +00:00
xtensa ASoC: xtfpga-i2s: replace platform to component 2018-02-12 11:45:32 +00:00
zte ASoC: zte: Fix incorrect PCM format bit usages 2018-07-26 15:48:19 +01:00
Kconfig ASoC: ti: Merge davinci and omap directories 2018-12-18 12:22:43 +00:00
Makefile ASoC: ti: Merge davinci and omap directories 2018-12-18 12:22:43 +00:00
soc-ac97.c ASoC: ac97: convert to SPDX identifiers 2018-07-02 10:56:09 +01:00
soc-acpi.c ASoC: acpi: fix: continue searching when machine is ignored 2018-11-20 16:53:17 +00:00
soc-compress.c ASoC: add for_each_dpcm_be() macro 2018-09-20 10:31:20 -07:00
soc-core.c ASoC: core: Don't defer probe on optional, NULL components 2019-01-15 18:57:17 +00:00
soc-dapm.c ASoC: dapm: change snprintf to scnprintf for possible overflow 2019-01-15 19:01:16 +00:00
soc-devres.c ASoC: soc-devres.c: convert to SPDX identifiers 2018-07-02 10:55:22 +01:00
soc-generic-dmaengine-pcm.c DMAengine updates for v4.19-rc1 2018-08-18 15:55:59 -07:00
soc-io.c ASoC: soc-io.c: convert to SPDX identifiers 2018-07-02 10:53:55 +01:00
soc-jack.c ASoC: soc-jack.c: convert to SPDX identifiers 2018-07-02 10:55:12 +01:00
soc-ops.c ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx() 2018-09-11 11:58:52 +01:00
soc-pcm.c ASoC: add for_each_dpcm_be() macro 2018-09-20 10:31:20 -07:00
soc-topology.c ASoC: topology: Use the standard fall-through annotations 2018-10-05 12:38:22 +01:00
soc-utils.c ASoC: soc-utils: Rename dummy_dma_ops to snd_dummy_dma_ops 2018-09-27 23:15:46 +01:00