linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model()
@ 2020-12-07 17:55 Dan Carpenter
  2020-12-08  9:53 ` Adam Ward
  2020-12-08 17:10 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-12-07 17:55 UTC (permalink / raw)
  To: Support Opensource, Adam Ward
  Cc: Liam Girdwood, Mark Brown, linux-kernel, kernel-janitors

There is a missing "return ret;" on this error path so we call
"da9121_check_device_type(i2c, chip);" which will end up dereferencing
"chip->regmap" and lead to an Oops.

Fixes: c860476b9e3a ("regulator: da9121: Add device variant regmaps")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/regulator/da9121-regulator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index db1c2cc838bc..e4fc3a7cd5d8 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -915,6 +915,7 @@ static int da9121_assign_chip_model(struct i2c_client *i2c,
 		ret = PTR_ERR(chip->regmap);
 		dev_err(chip->dev, "Failed to configure a register map: %d\n",
 			ret);
+		return ret;
 	}
 
 	ret = da9121_check_device_type(i2c, chip);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model()
  2020-12-07 17:55 [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model() Dan Carpenter
@ 2020-12-08  9:53 ` Adam Ward
  2020-12-08 17:10 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Adam Ward @ 2020-12-08  9:53 UTC (permalink / raw)
  To: Dan Carpenter, Support Opensource, Adam Ward
  Cc: Liam Girdwood, Mark Brown, linux-kernel, kernel-janitors

Acked-by: Adam Ward <Adam.Ward.opensource@diasemi.com>

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: 07 December 2020 17:56
> To: Support Opensource <Support.Opensource@diasemi.com>; Adam Ward
> <Adam.Ward.opensource@diasemi.com>
> Cc: Liam Girdwood <lgirdwood@gmail.com>; Mark Brown
> <broonie@kernel.org>; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH] regulator: da9121: Potential Oops in
> da9121_assign_chip_model()
> 
> There is a missing "return ret;" on this error path so we call
> "da9121_check_device_type(i2c, chip);" which will end up dereferencing
> "chip->regmap" and lead to an Oops.
> 
> Fixes: c860476b9e3a ("regulator: da9121: Add device variant regmaps")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/regulator/da9121-regulator.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-
> regulator.c
> index db1c2cc838bc..e4fc3a7cd5d8 100644
> --- a/drivers/regulator/da9121-regulator.c
> +++ b/drivers/regulator/da9121-regulator.c
> @@ -915,6 +915,7 @@ static int da9121_assign_chip_model(struct i2c_client
> *i2c,
>  		ret = PTR_ERR(chip->regmap);
>  		dev_err(chip->dev, "Failed to configure a register map: %d\n",
>  			ret);
> +		return ret;
>  	}
> 
>  	ret = da9121_check_device_type(i2c, chip);
> --
> 2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model()
  2020-12-07 17:55 [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model() Dan Carpenter
  2020-12-08  9:53 ` Adam Ward
@ 2020-12-08 17:10 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-12-08 17:10 UTC (permalink / raw)
  To: Adam Ward, Support Opensource, Dan Carpenter
  Cc: Liam Girdwood, linux-kernel, kernel-janitors

On Mon, 7 Dec 2020 20:55:44 +0300, Dan Carpenter wrote:
> There is a missing "return ret;" on this error path so we call
> "da9121_check_device_type(i2c, chip);" which will end up dereferencing
> "chip->regmap" and lead to an Oops.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: da9121: Potential Oops in da9121_assign_chip_model()
      commit: 8db06423e079b1f6c0657e5bebda0006acf75c3c

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-08 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 17:55 [PATCH] regulator: da9121: Potential Oops in da9121_assign_chip_model() Dan Carpenter
2020-12-08  9:53 ` Adam Ward
2020-12-08 17:10 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).