mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset()
@ 2019-10-30 16:53 Andrey Smirnov
  2019-10-30 17:08 ` Lucas Stach
  2019-11-04  8:13 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Andrey Smirnov @ 2019-10-30 16:53 UTC (permalink / raw)
  To: barebox; +Cc: 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 <andrew.smirnov@gmail.com>
---
 arch/arm/boards/zii-common/switch-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/zii-common/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c
index 30438053a1..2b9c34bfac 100644
--- a/arch/arm/boards/zii-common/switch-cmd.c
+++ b/arch/arm/boards/zii-common/switch-cmd.c
@@ -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
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset()
  2019-10-30 16:53 [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset() Andrey Smirnov
@ 2019-10-30 17:08 ` Lucas Stach
  2019-11-04  8:13 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2019-10-30 17:08 UTC (permalink / raw)
  To: Andrey Smirnov, barebox

On Mi, 2019-10-30 at 09:53 -0700, Andrey Smirnov wrote:
> 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 <andrew.smirnov@gmail.com>

Urgh, I remember that I fixed the very same bug some time ago. Seems I
lost that fixup before upstreaming...

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  arch/arm/boards/zii-common/switch-cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boards/zii-common/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c
> index 30438053a1..2b9c34bfac 100644
> --- a/arch/arm/boards/zii-common/switch-cmd.c
> +++ b/arch/arm/boards/zii-common/switch-cmd.c
> @@ -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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset()
  2019-10-30 16:53 [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset() Andrey Smirnov
  2019-10-30 17:08 ` Lucas Stach
@ 2019-11-04  8:13 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-11-04  8:13 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Wed, Oct 30, 2019 at 09:53:21AM -0700, Andrey Smirnov wrote:
> 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 <andrew.smirnov@gmail.com>
> ---
>  arch/arm/boards/zii-common/switch-cmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-11-04  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 16:53 [PATCH] ARM: zii-commmon: Fix NULL pointer dereference in do_rdu1_switch_reset() Andrey Smirnov
2019-10-30 17:08 ` Lucas Stach
2019-11-04  8:13 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox