Skip to contentSkip to conversation

clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereference

PATCH Applied Adam Ford 3 participants 4 messages Aug 26, 2021 – Aug 29, 2021

Subsystems (3)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereference

The probe was manually passing NULL instead of dev to devm_clk_hw_register. This caused a Unable to handle kernel NULL pointer dereference error. Fix this by passing 'dev'.

drivers/clk/renesas/rcar-usb2-clock-sel.c +1 -1
index 9fb79bd79435..684d8937965e 100644
@@ -187,7 +187,7 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
 	init.ops = &usb2_clock_sel_clock_ops;
 	priv->hw.init = &init;
 
-	ret = devm_clk_hw_register(NULL, &priv->hw);
+	ret = devm_clk_hw_register(dev, &priv->hw);
 	if (ret)
 		goto pm_put;
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Adam Ford

The probe was manually passing NULL instead of dev to devm_clk_hw_register. This caused a Unable to handle kernel NULL pointer dereference error. Fix this by passing 'dev'.

Fixes a20a40a8bbc2cf4b ("clk: renesas: rcar-usb2-clock-sel: Fix error

handling in .probe()")

Mike/Stephen: Can you please take this one directly, as we're already at rc7.
Thanks!

Quoted 12 lines
drivers/clk/renesas/rcar-usb2-clock-sel.c +1 -2
@@ -187,7 +187,7 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev)
        init.ops = &usb2_clock_sel_clock_ops;
        priv->hw.init = &init;
 
-       ret = devm_clk_hw_register(NULL, &priv->hw);
+       ret = devm_clk_hw_register(dev, &priv->hw);
        if (ret)
                goto pm_put;
 
--
Quoted 1 line

2.25.1

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#2 lore raw

Quoting Geert Uytterhoeven (2021-08-26 10:42:29)

Quoted 7 lines · Adam Ford
Quoted 5 lines

The probe was manually passing NULL instead of dev to devm_clk_hw_register. This caused a Unable to handle kernel NULL pointer dereference error. Fix this by passing 'dev'.

Quoted 8 lines
Fixes a20a40a8bbc2cf4b ("clk: renesas: rcar-usb2-clock-sel: Fix error

handling in .probe()")

Mike/Stephen: Can you please take this one directly, as we're already at rc7.
Thanks!

It looks highly unlikely to make the cut but I'll try to send it off to Linus tomorrow.

maintainer Applied
#3 lore raw
In reply to Adam Ford

Quoting Adam Ford (2021-08-26 07:17:21)

drivers/clk/renesas/rcar-usb2-clock-sel.c

Quoted 9 lines

The probe was manually passing NULL instead of dev to devm_clk_hw_register. This caused a Unable to handle kernel NULL pointer dereference error. Fix this by passing 'dev'.

drivers/clk/renesas/rcar-usb2-clock-sel.c +0 -1
index 9fb79bd79435..684d8937965e 100644
--- a/drivers/clk/renesas/rcar-usb2-clock-sel.c

Applied to clk-fixes