CVE-2022-49285

iio: accel: mma8452: use the correct logic to get mma8452_data

MEDIUM
5.5
CVSS Score
Published: February 26, 2025 at 01:56 AM UTC
Updated: June 17, 2026 at 05:17 AM UTC
1 product affected across 1 vendorLinux Kernel

Using Linux by Linux?

Get instant alerts when new vulnerabilities affect Linux - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
MEDIUM5.5
Exploit prediction
EPSS 0.3%

Description

In the Linux kernel, the following vulnerability has been resolved: iio: accel: mma8452: use the correct logic to get mma8452_data The original logic to get mma8452_data is wrong, the *dev point to the device belong to iio_dev. we can't use this dev to find the correct i2c_client. The original logic happen to work because it finally use dev->driver_data to get iio_dev. Here use the API to_i2c_client() is wrong and make reader confuse. To correct the logic, it should be like this struct mma8452_data *data = iio_priv(dev_get_drvdata(dev)); But after commit 8b7651f25962 ("iio: iio_device_alloc(): Remove unnecessary self drvdata"), the upper logic also can't work. When try to show the avialable scale in userspace, will meet kernel dump, kernel handle NULL pointer dereference. So use dev_to_iio_dev() to correct the logic. Dual fixes tags as the second reflects when the bug was exposed, whilst the first reflects when the original bug was introduced.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

4.4 ≤ v < 5.15.544.4 ≤ v < 5.17.24.4 ≤ v < 5.185.16 ≤ v < 5.17.24.4c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527
Vendor states this is fixed in 4c0bb583a4444cce224e8661090cbffc98e2fe07 (fixed)
Vendor states this is fixed in c87b7b12f48db86ac9909894f4dc0107d7df6375 (fixed)
Vendor states this is fixed in d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf (fixed)
Vendor states this is fixed in 4.4 (unaffected)
Vendor states this is fixed in 5.15.54 (unaffected)
Vendor states this is fixed in 5.17.2 (unaffected)
Vendor states this is fixed in 5.18 (unaffected)

References (3)

Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/4c0bb583a4444cce224e8661090cbffc98e2fe07
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/c87b7b12f48db86ac9909894f4dc0107d7df6375
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf

CVSS

Attack Vector
LOCAL
Complexity
LOW
Privileges
LOW
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
NONE
Availability
HIGH
Vector?

Quick Info

StatusANALYZED
CWE
CWE-476

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card