Linux-Clk Archive on lore.kernel.org
 help / Atom feed
* [PATCH] clk: tegra: dfll: Fix a potential Oop in remove()
@ 2018-12-18  8:22 Dan Carpenter
  2019-01-09 18:35 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-12-18  8:22 UTC (permalink / raw)
  To: Peter De Schrijver, Nicolin Chen
  Cc: Prashant Gaikwad, Michael Turquette, Stephen Boyd,
	Thierry Reding, Jonathan Hunter, linux-clk, linux-tegra,
	kernel-janitors

If tegra_dfll_unregister() fails then "soc" is an error pointer.  We
should just return instead of dereferencing it.

Fixes: 1752c9ee23fb ("clk: tegra: dfll: Fix drvdata overwriting issue")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
index 269d3595758b..edc31bb56674 100644
--- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
+++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
@@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev)
 	struct tegra_dfll_soc_data *soc;
 
 	soc = tegra_dfll_unregister(pdev);
-	if (IS_ERR(soc))
+	if (IS_ERR(soc)) {
 		dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n",
 			PTR_ERR(soc));
+		return PTR_ERR(soc);
+	}
 
 	tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq);
 
-- 
2.17.1


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

* Re: [PATCH] clk: tegra: dfll: Fix a potential Oop in remove()
  2018-12-18  8:22 [PATCH] clk: tegra: dfll: Fix a potential Oop in remove() Dan Carpenter
@ 2019-01-09 18:35 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2019-01-09 18:35 UTC (permalink / raw)
  To: Dan Carpenter, Nicolin Chen, Peter De Schrijver
  Cc: Prashant Gaikwad, Michael Turquette, Thierry Reding,
	Jonathan Hunter, linux-clk, linux-tegra, kernel-janitors

Quoting Dan Carpenter (2018-12-18 00:22:41)
> If tegra_dfll_unregister() fails then "soc" is an error pointer.  We
> should just return instead of dereferencing it.
> 
> Fixes: 1752c9ee23fb ("clk: tegra: dfll: Fix drvdata overwriting issue")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Applied to clk-fixes


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18  8:22 [PATCH] clk: tegra: dfll: Fix a potential Oop in remove() Dan Carpenter
2019-01-09 18:35 ` Stephen Boyd

Linux-Clk Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-clk/0 linux-clk/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-clk linux-clk/ https://lore.kernel.org/linux-clk \
		linux-clk@vger.kernel.org linux-clk@archiver.kernel.org
	public-inbox-index linux-clk


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-clk


AGPL code for this site: git clone https://public-inbox.org/ public-inbox