qemu-patch-raspberry4/hw
Philippe Mathieu-Daudé a2cd86a94a hw/audio/sb16: Avoid assertion by restricting I/O sampling rate range
While the SB16 seems to work up to 48000 Hz, the "Sound Blaster Series
Hardware Programming Guide" limit the sampling range from 4000 Hz to
44100 Hz (Section 3-9, 3-10: Digitized Sound I/O Programming, tables
3-2 and 3-3).

Later, section 6-15 (DSP Commands) is more specific regarding the 41h /
42h registers (Set digitized sound output sampling rate):

  Valid sampling rates range from 5000 to 45000 Hz inclusive.

There is no comment regarding error handling if the register is filled
with an out-of-range value.  (See also section 3-28 "8-bit or 16-bit
Auto-initialize Transfer"). Assume limits are enforced in hardware.

This fixes triggering an assertion in audio_calloc():

  #1 abort
  #2 audio_bug audio/audio.c:119:9
  #3 audio_calloc audio/audio.c:154:9
  #4 audio_pcm_sw_alloc_resources_out audio/audio_template.h:116:15
  #5 audio_pcm_sw_init_out audio/audio_template.h:175:11
  #6 audio_pcm_create_voice_pair_out audio/audio_template.h:410:9
  #7 AUD_open_out audio/audio_template.h:503:14
  #8 continue_dma8 hw/audio/sb16.c:216:20
  #9 dma_cmd8 hw/audio/sb16.c:276:5
  #10 command hw/audio/sb16.c:0
  #11 dsp_write hw/audio/sb16.c:949:13
  #12 portio_write softmmu/ioport.c:205:13
  #13 memory_region_write_accessor softmmu/memory.c:491:5
  #14 access_with_adjusted_size softmmu/memory.c:552:18
  #15 memory_region_dispatch_write softmmu/memory.c:0:13
  #16 flatview_write_continue softmmu/physmem.c:2759:23
  #17 flatview_write softmmu/physmem.c:2799:14
  #18 address_space_write softmmu/physmem.c:2891:18
  #19 cpu_outw softmmu/ioport.c:70:5

[*] http://www.baudline.com/solutions/full_duplex/sb16_pci/index.html

OSS-Fuzz Report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29174

Fixes: 85571bc741 ("audio merge (malc)")
Buglink: https://bugs.launchpad.net/bugs/1910603
Tested-by: Qiang Liu <cyruscyliu@gmail.com>
Reviewed-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210616104349.2398060-1-f4bug@amsat.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-06-17 11:55:23 +02:00
..
9pfs docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
acpi acpi: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-15 10:55:03 -04:00
adc docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
alpha docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
arm target-arm queue: 2021-06-16 17:02:30 +01:00
audio hw/audio/sb16: Avoid assertion by restricting I/O sampling rate range 2021-06-17 11:55:23 +02:00
avr hw/avr/atmega.c: use the avr51 cpu for atmega1280 2021-05-13 19:11:42 +02:00
block docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
char docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
core hw/core/cpu: removed cpu_dump_statistics function 2021-06-03 18:10:31 +10:00
cpu cpu/core: Fix "help" of CPU core device types 2021-04-09 16:05:16 -04:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
display virtio-gpu: move scanout_id sanity check 2021-06-15 07:16:56 +02:00
dma docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
gpio misc: Correct relative include path 2021-06-05 21:10:42 +02:00
hppa docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
hyperv qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
i2c docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
i386 i386: Eliminate all TPM related code if CONFIG_TPM is not set 2021-06-15 10:54:46 -04:00
ide docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
input docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
intc hw/intc/armv7m_nvic: Remove stale comment 2021-06-15 16:18:48 +01:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
isa docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
m68k Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
mem docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
microblaze Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
mips target/mips: Fold jazz behaviour into mips_cpu_do_transaction_failed 2021-05-26 15:33:59 -07:00
misc arm: Consistently use "Cortex-Axx", not "Cortex Axx" 2021-06-03 16:43:25 +01:00
net -----BEGIN PGP SIGNATURE----- 2021-06-04 13:38:49 +01:00
nios2 Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nubus hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
nvme hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00
nvram docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
openrisc Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
pci-bridge Kconfig: Compile PXB for ARM_VIRT 2021-01-17 06:42:54 -05:00
pci-host docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
pcmcia hw/pcmcia: Do not register PCMCIA type if not required 2021-05-02 17:24:50 +02:00
ppc ppc/pef.c: initialize cgs->ready in kvmppc_svm_init() 2021-06-03 18:10:31 +10:00
rdma docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
remote multi-process: Initialize variables declared with g_auto* 2021-05-21 15:43:57 +01:00
riscv hw/riscv: microchip_pfsoc: Support direct kernel boot 2021-06-08 09:59:42 +10:00
rtc docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
rx hw/rx/rx-gdbsim: Do not accept invalid memory size 2021-05-03 10:07:41 +02:00
s390x docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
scsi docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
sd docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
sh4 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smbios hw/smbios: support for type 41 (onboard devices extended information) 2021-05-14 10:26:18 -04:00
sparc docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
sparc64 docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
ssi Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
timer docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
tpm docs: fix references to docs/specs/tpm.rst 2021-06-02 06:51:09 +02:00
tricore hw/tricore: Add testdevice for tests in tests/tcg/ 2021-05-18 09:36:21 +01:00
usb usb/dev-mtp: use GDateTime for formatting timestamp for objects 2021-06-14 13:28:50 +01:00
vfio docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
virtio vhost-vdpa: don't initialize backend_features 2021-06-11 10:30:13 +08:00
watchdog docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
xen docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
Kconfig hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00
meson.build hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00