CVE-2022-49292
Published: 26 February 2025
Description
In the Linux kernel, the following vulnerability has been resolved: ALSA: oss: Fix PCM OSS buffer allocation overflow We've got syzbot reports hitting INT_MAX overflow at vmalloc() allocation that is called from snd_pcm_plug_alloc(). Although we apply the restrictions to input parameters, it's based only on the hw_params of the underlying PCM device. Since the PCM OSS layer allocates a temporary buffer for the data conversion, the size may become unexpectedly large when more channels or higher rates is given; in the reported case, it went over INT_MAX, hence it hits WARN_ON(). This patch is an attempt to avoid such an overflow and an allocation for too large buffers. First off, it adds the limit of 1MB as the upper bound for period bytes. This must be large enough for all use cases, and we really don't want to handle a larger temporary buffer than this size. The size check is performed at two places, where the original period bytes is calculated and where the plugin buffer size is calculated. In addition, the driver uses array_size() and array3_size() for multiplications to catch overflows for the converted period size and buffer bytes.
Security Summary
CVE-2022-49292 is an integer overflow vulnerability in the Linux kernel's ALSA OSS subsystem, specifically affecting PCM OSS buffer allocation in the snd_pcm_plug_alloc() function. The issue arises when the OSS layer allocates a temporary buffer for data conversion, where input parameters like higher channels or rates can exceed hardware parameter restrictions, leading to sizes surpassing INT_MAX and triggering WARN_ON() during vmalloc() allocation. This out-of-bounds write (CWE-787) has a CVSS v3.1 base score of 7.8.
A local attacker with low privileges (AV:L/AC:L/PR:L/UI:N/S:U) can exploit this vulnerability by providing crafted parameters to the PCM OSS plugin, potentially causing memory corruption, denial of service, or unauthorized access due to the high impacts on confidentiality, integrity, and availability (C:H/I:H/A:H).
Kernel patch commits referenced in advisories, such as those at git.kernel.org/stable/c/0c4190b41a69990666b4000999e27f8f1b2a426b and others, mitigate the issue by imposing a 1MB upper limit on period bytes, performing size checks during original period bytes and plugin buffer calculations, and using array_size() and array3_size() functions to detect overflows in multiplications for converted period sizes and buffer bytes. Security practitioners should update to kernels incorporating these stable fixes.
Details
- CWE(s)