ARM: omap2+: hwmod: fix potential NULL pointer access
commit b070f9ca78 upstream.
omap_hwmod_get_pwrdm() may access a NULL clk_hw pointer in some failure
cases. Add a check for the case and bail out gracely if this happens.
Reported-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9851ad2f71
commit
3d7d2d2b06
@@ -3777,6 +3777,7 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
|
|||||||
struct omap_hwmod_ocp_if *oi;
|
struct omap_hwmod_ocp_if *oi;
|
||||||
struct clockdomain *clkdm;
|
struct clockdomain *clkdm;
|
||||||
struct clk_hw_omap *clk;
|
struct clk_hw_omap *clk;
|
||||||
|
struct clk_hw *hw;
|
||||||
|
|
||||||
if (!oh)
|
if (!oh)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3793,7 +3794,14 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
|
|||||||
c = oi->_clk;
|
c = oi->_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
clk = to_clk_hw_omap(__clk_get_hw(c));
|
hw = __clk_get_hw(c);
|
||||||
|
if (!hw)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
clk = to_clk_hw_omap(hw);
|
||||||
|
if (!clk)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
clkdm = clk->clkdm;
|
clkdm = clk->clkdm;
|
||||||
if (!clkdm)
|
if (!clkdm)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user