ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset()
PATCH 1/1 ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset()
We need to go to parent's private data to get a pointer to struct rave_sp. Fix that.
Fixes 493e2ee38f ("ARM: zii-common: add support for switch reset on RDU1")
Signed-off-by Andrey Smirnov <[email protected]>
--- arch/arm/boards/zii-common/switch-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boards/zii-common/switch-cmd.c +1 -1
@@ -42,7 +42,7 @@ static int do_rdu2_switch_reset(void)static int do_rdu1_switch_reset (void ) {struct device_d *sp_dev =get_device_by_name ("sp" ); -struct rave_sp *sp = sp_dev->priv; +struct rave_sp *sp = sp_dev->parent->priv;u8 cmd[] = { [0 ] =RAVE_SP_CMD_RESET_ETH_SWITCH , [1 ] =0
Signature · 7 lines
2.21.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 5 lines · Andrey Smirnov
We need to go to parent's private data to get a pointer to struct
rave_sp. Fix that.Fixes 493e2ee38f ("ARM: zii-common: add support for switch reset on RDU1")Signed-off-by Andrey Smirnov <[email protected]>
Urgh, I remember that I fixed the very same bug some time ago. Seems I lost that fixup before upstreaming...
Reviewed-by Lucas Stach <[email protected]>
Quoted 9 lines
--- arch/arm/boards/zii-common/switch-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boards/zii-common/switch-cmd.c +0
-0
arch/arm/boards/zii-common/switch-cmd.c static int do_rdu2_switch_reset(void) · line 48
Quoted 8 lines
arch/arm/boards/zii-common/switch-cmd.c +1
-1@@ -42,7 +42,7 @@ static int do_rdu2_switch_reset(void)static int do_rdu1_switch_reset (void ) {struct device_d *sp_dev =get_device_by_name ("sp" ); -struct rave_sp *sp = sp_dev->priv; +struct rave_sp *sp = sp_dev->parent->priv;u8 cmd[] = { [0 ] =RAVE_SP_CMD_RESET_ETH_SWITCH , [1 ] =0
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 8 lines · Andrey Smirnov
We need to go to parent's private data to get a pointer to struct
rave_sp. Fix that.Fixes 493e2ee38f ("ARM: zii-common: add support for switch reset on RDU1")Signed-off-by Andrey Smirnov <[email protected]>--- arch/arm/boards/zii-common/switch-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox