{"id":"CVE-2025-38395","state":"PUBLISHED","title":"regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nregulator: gpio: Fix the out-of-bounds access to drvdata::gpiods\n\ndrvdata::gpiods is supposed to hold an array of 'gpio_desc' pointers. But\nthe memory is allocated for only one pointer. This will lead to\nout-of-bounds access later in the code if 'config::ngpios' is > 1. So\nfix the code to allocate enough memory to hold 'config::ngpios' of GPIO\ndescriptors.\n\nWhile at it, also move the check for memory allocation failure to be below\nthe allocation to make it more readable.","publishedAt":"2025-07-25T12:53:39.933Z","updatedAt":"2026-08-05T12:01:33.139Z","severity":{"score":8.4,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"a3cd5ae7befbac849e0e0529c94ca04e8093cfd2","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"9fe71972869faed1f8f9b3beb9040f9c1b300c79","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"56738cbac3bbb1d39a71a07f57484dec1db8b239","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"24418bc77a66cb5be9f5a837431ba3674ed8b52f","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"e4d19e5d71b217940e33f2ef6c6962b7b68c5606","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"3830ab97cda9599872625cc0dc7b00160193634f","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/regulator/gpio-regulator.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.1","versionType":"semver"},{"version":"5.4.296","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.240","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.187","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.144","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.97","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.37","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.6","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/regulator/gpio-regulator.c"]}],"references":["https://git.kernel.org/stable/c/a3cd5ae7befbac849e0e0529c94ca04e8093cfd2","https://git.kernel.org/stable/c/9fe71972869faed1f8f9b3beb9040f9c1b300c79","https://git.kernel.org/stable/c/56738cbac3bbb1d39a71a07f57484dec1db8b239","https://git.kernel.org/stable/c/a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a","https://git.kernel.org/stable/c/24418bc77a66cb5be9f5a837431ba3674ed8b52f","https://git.kernel.org/stable/c/e4d19e5d71b217940e33f2ef6c6962b7b68c5606","https://git.kernel.org/stable/c/3830ab97cda9599872625cc0dc7b00160193634f","https://git.kernel.org/stable/c/c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3","https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html","https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38395.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38395","state":"PUBLISHED","datePublished":"2025-07-25T12:53:39.933Z","dateUpdated":"2026-08-05T12:01:33.139Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.011Z"},"containers":{"cna":{"title":"regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nregulator: gpio: Fix the out-of-bounds access to drvdata::gpiods\n\ndrvdata::gpiods is supposed to hold an array of 'gpio_desc' pointers. But\nthe memory is allocated for only one pointer. This will lead to\nout-of-bounds access later in the code if 'config::ngpios' is > 1. So\nfix the code to allocate enough memory to hold 'config::ngpios' of GPIO\ndescriptors.\n\nWhile at it, also move the check for memory allocation failure to be below\nthe allocation to make it more readable."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"a3cd5ae7befbac849e0e0529c94ca04e8093cfd2","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"9fe71972869faed1f8f9b3beb9040f9c1b300c79","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"56738cbac3bbb1d39a71a07f57484dec1db8b239","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"24418bc77a66cb5be9f5a837431ba3674ed8b52f","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"e4d19e5d71b217940e33f2ef6c6962b7b68c5606","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"3830ab97cda9599872625cc0dc7b00160193634f","versionType":"git"},{"version":"d6cd33ad71029a3f77ba1686caf55d4dea58d916","status":"affected","lessThan":"c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/regulator/gpio-regulator.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.1","versionType":"semver"},{"version":"5.4.296","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.240","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.187","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.144","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.97","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.37","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.6","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/regulator/gpio-regulator.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/a3cd5ae7befbac849e0e0529c94ca04e8093cfd2"},{"url":"https://git.kernel.org/stable/c/9fe71972869faed1f8f9b3beb9040f9c1b300c79"},{"url":"https://git.kernel.org/stable/c/56738cbac3bbb1d39a71a07f57484dec1db8b239"},{"url":"https://git.kernel.org/stable/c/a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a"},{"url":"https://git.kernel.org/stable/c/24418bc77a66cb5be9f5a837431ba3674ed8b52f"},{"url":"https://git.kernel.org/stable/c/e4d19e5d71b217940e33f2ef6c6962b7b68c5606"},{"url":"https://git.kernel.org/stable/c/3830ab97cda9599872625cc0dc7b00160193634f"},{"url":"https://git.kernel.org/stable/c/c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","baseScore":8.4,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The flaw is in a platform driver bound from device-tree/ACPI data on the local system; the out-of-bounds write occurs in local kernel context during probe with no network or physical interaction required for the corruption itself. Matches the AV:L convention used for analogous probe-time allocation-size bugs such as CVE-2025-39869 and CVE-2025-38446.\nAC:L - On any affected board the overflow is fully deterministic — it fires on every single boot with no race, no timing window, and no dependence on unpredictable state, since ngpios>=2 is a binding-documented configuration (maxItems: 8, and the binding's own example uses 2 GPIOs). No condition beyond the attacker's control must be won per attempt.\nPR:N - The out-of-bounds write executes during subsys_initcall driver probe at boot, before any user logs in or is authenticated, so zero privileges are required for the memory corruption to occur. This matches the PR:N assignment given to the directly analogous probe-time undersized-allocation heap overflow in CVE-2025-39869.\nUI:N - No victim action is needed; the corruption happens automatically when the gpio-regulator driver probes the device, and the subsequent out-of-bounds reads occur on routine in-kernel regulator voltage changes.\nS:U - The heap corruption and the wild-pointer dereferences are confined to kernel memory managed by the same security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Beyond the OOB write, gpio_regulator_set_voltage() and gpio_regulator_set_current_limit() read gpiods[0..nr_gpios-1] past the 8-byte allocation and treat adjacent slab contents as struct gpio_desc pointers, exposing kernel heap data; a heap overflow of this kind is leverageable for arbitrary read.\nI:H - Up to seven attacker/firmware-influenced pointer values are written past the end of the allocation into an adjacent slab object, and the out-of-bounds pointers are then passed to gpiod_set_value_cansleep(), yielding a controlled write primitive exploitable for control-flow hijacking.\nA:H - Slab corruption plus dereference of out-of-bounds heap data as gpio_desc pointers reliably produces a kernel oops or panic — the identical bug class in CVE-2025-39869 manifested as \"Oops - undefined instruction\" crashes during driver probe."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:01:33.139Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"5.4.296"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"5.10.240"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"5.15.187"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.1.144"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.6.97"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.12.37"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.15.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.1","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html"},{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T17:37:28.806Z"}}]}}}