In the Linux kernel, the following vulnerability has been resolved:
regulator: gpio: Fix the out-of-bounds access to drvdata::gpiods
drvdata::gpiods is supposed to hold an array of 'gpio_desc' pointers. But the memory is allocated for only one pointer. This will lead to out-of-bounds access later in the code if 'config::ngpios' is > 1. So fix the code to allocate enough memory to hold 'config::ngpios' of GPIO descriptors.
While at it, also move the check for memory allocation failure to be below the allocation to make it more readable.
[ { "signature_type": "Line", "id": "CVE-2025-38395-0544202d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24418bc77a66cb5be9f5a837431ba3674ed8b52f", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-076d033e", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4d19e5d71b217940e33f2ef6c6962b7b68c5606", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-10b2ad74", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4d19e5d71b217940e33f2ef6c6962b7b68c5606", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-1333e33c", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-3453baa4", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3830ab97cda9599872625cc0dc7b00160193634f", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-5a612c30", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a3cd5ae7befbac849e0e0529c94ca04e8093cfd2", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-80c5a284", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@56738cbac3bbb1d39a71a07f57484dec1db8b239", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-9fa9674b", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1e12fac214d4f49fcb186dbdf9c5592e7fa0a7a", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-a5267df9", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24418bc77a66cb5be9f5a837431ba3674ed8b52f", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-d55c5b3b", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@56738cbac3bbb1d39a71a07f57484dec1db8b239", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-d69c02ed", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-dccf8d60", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9764fd88bc744592b0604ccb6b6fc1a5f76b4e3", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "14725267933637663918341980052284292166", "length": 2738.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-ddaa3c05", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a3cd5ae7befbac849e0e0529c94ca04e8093cfd2", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "17783121668757377001067219997717566495", "60469218258666831143415098171812107760", "309780668610029003232068151601182929403", "153411804031070220024378348267132352260", "328553375081196960010686897331251506353", "159927551258423167166006023353909409137", "296848077205886034027961988433324045742", "122822941533719961096411649259012776804" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-e9faab8c", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3830ab97cda9599872625cc0dc7b00160193634f", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "253489039738599316462105660371228098469", "length": 2770.0 }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2025-38395-f2268661", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9fe71972869faed1f8f9b3beb9040f9c1b300c79", "signature_version": "v1", "target": { "function": "gpio_regulator_probe", "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "function_hash": "336486891855170708216061133208347063079", "length": 2521.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2025-38395-f60fa1f8", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9fe71972869faed1f8f9b3beb9040f9c1b300c79", "signature_version": "v1", "target": { "file": "drivers/regulator/gpio-regulator.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "45883524069660879235908312969977402442", "275841463946487295983451998342851031017", "97149879706969747534377493039359420593", "52954820772751453592171769545192585966", "39940666215976416293559918839893670621" ] }, "deprecated": false } ]