{"id":"CVE-2022-49285","state":"PUBLISHED","title":"iio: accel: mma8452: use the correct logic to get mma8452_data","description":"In the Linux kernel, the following vulnerability has been resolved:\n\niio: accel: mma8452: use the correct logic to get mma8452_data\n\nThe original logic to get mma8452_data is wrong, the *dev point to\nthe device belong to iio_dev. we can't use this dev to find the\ncorrect i2c_client. The original logic happen to work because it\nfinally use dev->driver_data to get iio_dev. Here use the API\nto_i2c_client() is wrong and make reader confuse. To correct the\nlogic, it should be like this\n\n  struct mma8452_data *data = iio_priv(dev_get_drvdata(dev));\n\nBut after commit 8b7651f25962 (\"iio: iio_device_alloc(): Remove\nunnecessary self drvdata\"), the upper logic also can't work.\nWhen try to show the avialable scale in userspace, will meet kernel\ndump, kernel handle NULL pointer dereference.\n\nSo use dev_to_iio_dev() to correct the logic.\n\nDual fixes tags as the second reflects when the bug was exposed, whilst\nthe first reflects when the original bug was introduced.","publishedAt":"2025-02-26T01:56:25.096Z","updatedAt":"2026-05-11T18:56:44.269Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"4c0bb583a4444cce224e8661090cbffc98e2fe07","versionType":"git"},{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf","versionType":"git"},{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"c87b7b12f48db86ac9909894f4dc0107d7df6375","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/iio/accel/mma8452.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.4","versionType":"semver"},{"version":"5.15.54","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.17.2","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/iio/accel/mma8452.c"]}],"references":["https://git.kernel.org/stable/c/4c0bb583a4444cce224e8661090cbffc98e2fe07","https://git.kernel.org/stable/c/d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf","https://git.kernel.org/stable/c/c87b7b12f48db86ac9909894f4dc0107d7df6375"],"weaknesses":[],"ingestedAt":"2026-10-29T20:05:26.763Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/49xxx/CVE-2022-49285.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2022-49285","state":"PUBLISHED","datePublished":"2025-02-26T01:56:25.096Z","dateUpdated":"2026-05-11T18:56:44.269Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-02-26T01:49:39.298Z"},"containers":{"cna":{"title":"iio: accel: mma8452: use the correct logic to get mma8452_data","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\niio: accel: mma8452: use the correct logic to get mma8452_data\n\nThe original logic to get mma8452_data is wrong, the *dev point to\nthe device belong to iio_dev. we can't use this dev to find the\ncorrect i2c_client. The original logic happen to work because it\nfinally use dev->driver_data to get iio_dev. Here use the API\nto_i2c_client() is wrong and make reader confuse. To correct the\nlogic, it should be like this\n\n  struct mma8452_data *data = iio_priv(dev_get_drvdata(dev));\n\nBut after commit 8b7651f25962 (\"iio: iio_device_alloc(): Remove\nunnecessary self drvdata\"), the upper logic also can't work.\nWhen try to show the avialable scale in userspace, will meet kernel\ndump, kernel handle NULL pointer dereference.\n\nSo use dev_to_iio_dev() to correct the logic.\n\nDual fixes tags as the second reflects when the bug was exposed, whilst\nthe first reflects when the original bug was introduced."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"4c0bb583a4444cce224e8661090cbffc98e2fe07","versionType":"git"},{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf","versionType":"git"},{"version":"c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527","status":"affected","lessThan":"c87b7b12f48db86ac9909894f4dc0107d7df6375","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/iio/accel/mma8452.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.4","versionType":"semver"},{"version":"5.15.54","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.17.2","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/iio/accel/mma8452.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/4c0bb583a4444cce224e8661090cbffc98e2fe07"},{"url":"https://git.kernel.org/stable/c/d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf"},{"url":"https://git.kernel.org/stable/c/c87b7b12f48db86ac9909894f4dc0107d7df6375"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T18:56:44.269Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.4","versionEndExcluding":"5.15.54"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.4","versionEndExcluding":"5.17.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.4","versionEndExcluding":"5.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}