# CVE-2022-49285: iio: accel: mma8452: use the correct logic to get mma8452_data

- Severity: Medium 5.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.26%, higher than 18% of CVEs (2026-12-02)
- Published: 2025-02-26T01:56:25.096Z
- Modified: 2026-06-17T05:17:36.020Z
- Weaknesses: CWE-476
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 before 4c0bb583a4444cce224e8661090cbffc98e2fe07; from c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 before d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf; from c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 before c87b7b12f48db86ac9909894f4dc0107d7df6375; 4.4 (not affected: before 4.4; from 5.15.54 up to 5.15.*; from 5.17.2 up to 5.17.*; from 5.18 up to *)
- linux linux_kernel: from 4.4 before 5.15.54; from 5.16 before 5.17.2

## References

- <https://git.kernel.org/stable/c/4c0bb583a4444cce224e8661090cbffc98e2fe07> (patch)
- <https://git.kernel.org/stable/c/d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf> (patch)
- <https://git.kernel.org/stable/c/c87b7b12f48db86ac9909894f4dc0107d7df6375> (patch)

## Sources

- CVE List: [CVE-2022-49285](https://www.cve.org/CVERecord?id=CVE-2022-49285), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2022-49285](https://nvd.nist.gov/vuln/detail/CVE-2022-49285), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-49285 · Whole record: https://cve.day/CVE-2022-49285.json · Rebuilt by cve.day 2026-11-25T22:58:20.360Z
