drivers/regulator/fixed.c | 4 ++++ 1 file changed, 4 insertions(+)
The fixed regulator driver expects non-DT platform devices to provide
their configuration through platform_data as a struct fixed_voltage_config.
An explicitly bound driver can bypass the normal platform device/driver
matching and attach the fixed regulator driver to an unrelated platform
device. This causes the driver's platform_data to be interpreted as a
struct fixed_voltage_config even though it contains data for a different
device.
Reject non-DT platform devices whose name does not match the fixed
regulator driver before accessing their platform data.
Fixes: 4b74ff651249 ("regulator: add support for fixed regulators.")
Reported-by: syzbot+bfc9e55cf4f98183c636@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=bfc9e55cf4f98183c636
Signed-off-by: Chandradhar Kumar <chandradhar.2003@gmail.com>
---
drivers/regulator/fixed.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 417d282dd4ed..faa82f30eb1f 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -28,6 +28,7 @@
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/machine.h>
#include <linux/clk.h>
+#include <linux/string.h>
struct fixed_voltage_data {
struct regulator_desc desc;
@@ -225,6 +226,9 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
enum gpiod_flags gflags;
int ret;
+ if (!pdev->dev.of_node && strcmp(pdev->name, "reg-fixed-voltage"))
+ return -ENODEV;
+
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct fixed_voltage_data),
GFP_KERNEL);
if (!drvdata)
--
2.55.0
On Sat, 22 Aug 2026 12:25:19 +0530, Chandradhar Kumar wrote:
> regulator: fixed: reject incompatible platform devices
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.4
Thanks!
[1/1] regulator: fixed: reject incompatible platform devices
https://git.kernel.org/broonie/regulator/c/f7396c2dbbc1
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
© 2016 - 2026 Red Hat, Inc.