CVE-2022-49272: ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock

Published Feb 26, 2025
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

ALSA: pcm: Fix potential AB/BA lock with buffermutex and mmaplock

syzbot caught a potential deadlock between the PCM runtime->buffermutex and the mm->mmaplock. It was brought by the recent fix to cover the racy read/write and other ioctls, and in that commit, I overlooked a (hopefully only) corner case that may take the revert lock, namely, the OSS mmap. The OSS mmap operation exceptionally allows to re-configure the parameters inside the OSS mmap syscall, where mm->mmapmutex is already held. Meanwhile, the copyfrom/touser calls at read/write operations also take the mm->mmaplock internally, hence it may lead to a AB/BA deadlock.

A similar problem was already seen in the past and we fixed it with a refcount (in commit b248371628aa). The former fix covered only the call paths with OSS read/write and OSS ioctls, while we need to cover the concurrent access via both ALSA and OSS APIs now.

This patch addresses the problem above by replacing the buffermutex lock in the read/write operations with a refcount similar as we've used for OSS. The new field, runtime->bufferaccessing, keeps the number of concurrent read/write operations. Unlike the former buffermutex protection, this protects only around the copyfrom/touser() calls; the other codes are basically protected by the PCM stream lock. The refcount can be a negative, meaning blocked by the ioctls. If a negative value is seen, the read/write aborts with -EBUSY. In the ioctl side, OTOH, they check this refcount, too, and set to a negative value for blocking unless it's already being accessed.

Affected Software

9 affected componentsFixes available
Linux Linux kernel=
Linux Linux kernel=5.10.109
Linux Linux kernel=5.15.32
Linux Linux kernel=5.16.18
Linux Linux kernel=5.17.1
debian/linux<5.17.3-1
5.17.3-1
debian/linux<5.17.3-1
5.17.3-1
debian/linux<5.17.3-1
5.17.3-1
debian/linux
6.1.176-16.1.192-26.12.107-16.12.117-17.3.4-17.3.5-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.17.3-1
  2. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.1.176-1Fixed in 6.1.192-2Fixed in 6.12.107-1Fixed in 6.12.117-1Fixed in 7.3.4-1Fixed in 7.3.5-1

Event History

Feb 26, 2025
CVE Published
via MITRE·01:56 AM
Data Sourced
via MITRE·01:56 AM
Description
Data Sourced
via Red Hat·03:16 AM
DescriptionSeverityAffected Software
Data Sourced
via NVD·07:01 AM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·07:01 AM
DescriptionSeverityAffected Software

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203