Commit 8303d1ad authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'regulator-fix-v6.15-rc6' of...

Merge tag 'regulator-fix-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fix from Mark Brown:
 "This fixes an invalid memory access in the MAX20086 driver which could
  occur during error handling for failed probe due to a hidden use of
  devres in the core DT parsing code"

* tag 'regulator-fix-v6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: max20086: fix invalid memory access
parents 7dc774fd 6b0cd727
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static int max20086_regulators_register(struct max20086 *chip)

static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
{
	struct of_regulator_match matches[MAX20086_MAX_REGULATORS] = { };
	struct of_regulator_match *matches;
	struct device_node *node;
	unsigned int i;
	int ret;
@@ -143,6 +143,11 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
		return -ENODEV;
	}

	matches = devm_kcalloc(chip->dev, chip->info->num_outputs,
			       sizeof(*matches), GFP_KERNEL);
	if (!matches)
		return -ENOMEM;

	for (i = 0; i < chip->info->num_outputs; ++i)
		matches[i].name = max20086_output_names[i];