* [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 9:24 ` Bartosz Golaszewski
0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2020-05-27 9:24 UTC (permalink / raw)
To: John Crispin, Sean Wang, Mark Lee, David S . Miller,
Jakub Kicinski, Matthias Brugger
Cc: netdev, linux-arm-kernel, linux-mediatek, linux-kernel,
Fabien Parent, Stephane Le Provost, Pedro Tsai, Andrew Perepech,
Bartosz Golaszewski, Nathan Chancellor
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The dma_addr field in desc_data must not be overwritten until after the
new skb is mapped. Currently we do replace it with uninitialized value
in error path. This change fixes it by moving the assignment before the
label to which we jump after mapping or allocation errors.
Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
index b74349cede28..72bb624a6a68 100644
--- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
+++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
@@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
goto push_new_skb;
}
+ desc_data.dma_addr = new_dma_addr;
+
/* We can't fail anymore at this point: it's safe to unmap the skb. */
mtk_star_dma_unmap_rx(priv, &desc_data);
@@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
netif_receive_skb(desc_data.skb);
push_new_skb:
- desc_data.dma_addr = new_dma_addr;
desc_data.len = skb_tailroom(new_skb);
desc_data.skb = new_skb;
--
2.25.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 9:24 ` Bartosz Golaszewski
0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2020-05-27 9:24 UTC (permalink / raw)
To: John Crispin, Sean Wang, Mark Lee, David S . Miller,
Jakub Kicinski, Matthias Brugger
Cc: Stephane Le Provost, Bartosz Golaszewski, netdev, linux-kernel,
Fabien Parent, linux-mediatek, Andrew Perepech, Pedro Tsai,
Nathan Chancellor, linux-arm-kernel
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The dma_addr field in desc_data must not be overwritten until after the
new skb is mapped. Currently we do replace it with uninitialized value
in error path. This change fixes it by moving the assignment before the
label to which we jump after mapping or allocation errors.
Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
index b74349cede28..72bb624a6a68 100644
--- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
+++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
@@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
goto push_new_skb;
}
+ desc_data.dma_addr = new_dma_addr;
+
/* We can't fail anymore at this point: it's safe to unmap the skb. */
mtk_star_dma_unmap_rx(priv, &desc_data);
@@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
netif_receive_skb(desc_data.skb);
push_new_skb:
- desc_data.dma_addr = new_dma_addr;
desc_data.len = skb_tailroom(new_skb);
desc_data.skb = new_skb;
--
2.25.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 9:24 ` Bartosz Golaszewski
0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2020-05-27 9:24 UTC (permalink / raw)
To: John Crispin, Sean Wang, Mark Lee, David S . Miller,
Jakub Kicinski, Matthias Brugger
Cc: Stephane Le Provost, Bartosz Golaszewski, netdev, linux-kernel,
Fabien Parent, linux-mediatek, Andrew Perepech, Pedro Tsai,
Nathan Chancellor, linux-arm-kernel
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The dma_addr field in desc_data must not be overwritten until after the
new skb is mapped. Currently we do replace it with uninitialized value
in error path. This change fixes it by moving the assignment before the
label to which we jump after mapping or allocation errors.
Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
index b74349cede28..72bb624a6a68 100644
--- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
+++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
@@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
goto push_new_skb;
}
+ desc_data.dma_addr = new_dma_addr;
+
/* We can't fail anymore at this point: it's safe to unmap the skb. */
mtk_star_dma_unmap_rx(priv, &desc_data);
@@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
netif_receive_skb(desc_data.skb);
push_new_skb:
- desc_data.dma_addr = new_dma_addr;
desc_data.len = skb_tailroom(new_skb);
desc_data.skb = new_skb;
--
2.25.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
2020-05-27 9:24 ` Bartosz Golaszewski
(?)
@ 2020-05-27 15:54 ` Nathan Chancellor
-1 siblings, 0 replies; 9+ messages in thread
From: Nathan Chancellor @ 2020-05-27 15:54 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: John Crispin, Sean Wang, Mark Lee, David S . Miller,
Jakub Kicinski, Matthias Brugger, netdev, linux-arm-kernel,
linux-mediatek, linux-kernel, Fabien Parent, Stephane Le Provost,
Pedro Tsai, Andrew Perepech, Bartosz Golaszewski
On Wed, May 27, 2020 at 11:24:04AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build
> ---
> drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> index b74349cede28..72bb624a6a68 100644
> --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
> +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> @@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> goto push_new_skb;
> }
>
> + desc_data.dma_addr = new_dma_addr;
> +
> /* We can't fail anymore at this point: it's safe to unmap the skb. */
> mtk_star_dma_unmap_rx(priv, &desc_data);
>
> @@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> netif_receive_skb(desc_data.skb);
>
> push_new_skb:
> - desc_data.dma_addr = new_dma_addr;
> desc_data.len = skb_tailroom(new_skb);
> desc_data.skb = new_skb;
>
> --
> 2.25.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 15:54 ` Nathan Chancellor
0 siblings, 0 replies; 9+ messages in thread
From: Nathan Chancellor @ 2020-05-27 15:54 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Stephane Le Provost, Bartosz Golaszewski, netdev, Sean Wang,
linux-kernel, Mark Lee, Fabien Parent, Pedro Tsai,
linux-mediatek, Andrew Perepech, John Crispin, Matthias Brugger,
Jakub Kicinski, David S . Miller, linux-arm-kernel
On Wed, May 27, 2020 at 11:24:04AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build
> ---
> drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> index b74349cede28..72bb624a6a68 100644
> --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
> +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> @@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> goto push_new_skb;
> }
>
> + desc_data.dma_addr = new_dma_addr;
> +
> /* We can't fail anymore at this point: it's safe to unmap the skb. */
> mtk_star_dma_unmap_rx(priv, &desc_data);
>
> @@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> netif_receive_skb(desc_data.skb);
>
> push_new_skb:
> - desc_data.dma_addr = new_dma_addr;
> desc_data.len = skb_tailroom(new_skb);
> desc_data.skb = new_skb;
>
> --
> 2.25.0
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 15:54 ` Nathan Chancellor
0 siblings, 0 replies; 9+ messages in thread
From: Nathan Chancellor @ 2020-05-27 15:54 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Stephane Le Provost, Bartosz Golaszewski, netdev, Sean Wang,
linux-kernel, Mark Lee, Fabien Parent, Pedro Tsai,
linux-mediatek, Andrew Perepech, John Crispin, Matthias Brugger,
Jakub Kicinski, David S . Miller, linux-arm-kernel
On Wed, May 27, 2020 at 11:24:04AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build
> ---
> drivers/net/ethernet/mediatek/mtk_star_emac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> index b74349cede28..72bb624a6a68 100644
> --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
> +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
> @@ -1308,6 +1308,8 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> goto push_new_skb;
> }
>
> + desc_data.dma_addr = new_dma_addr;
> +
> /* We can't fail anymore at this point: it's safe to unmap the skb. */
> mtk_star_dma_unmap_rx(priv, &desc_data);
>
> @@ -1318,7 +1320,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv)
> netif_receive_skb(desc_data.skb);
>
> push_new_skb:
> - desc_data.dma_addr = new_dma_addr;
> desc_data.len = skb_tailroom(new_skb);
> desc_data.skb = new_skb;
>
> --
> 2.25.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
2020-05-27 9:24 ` Bartosz Golaszewski
(?)
@ 2020-05-27 18:25 ` David Miller
-1 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2020-05-27 18:25 UTC (permalink / raw)
To: brgl
Cc: john, sean.wang, Mark-MC.Lee, kuba, matthias.bgg, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel, fparent,
stephane.leprovost, pedro.tsai, andrew.perepech, bgolaszewski,
natechancellor
From: Bartosz Golaszewski <brgl@bgdev.pl>
Date: Wed, 27 May 2020 11:24:04 +0200
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Applied, please use "[PATCH net-next]" to clearly indicate the target
GIT tree next time.
Thank you.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 18:25 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2020-05-27 18:25 UTC (permalink / raw)
To: brgl
Cc: stephane.leprovost, bgolaszewski, netdev, sean.wang,
linux-kernel, fparent, pedro.tsai, linux-mediatek,
andrew.perepech, john, matthias.bgg, kuba, natechancellor,
Mark-MC.Lee, linux-arm-kernel
From: Bartosz Golaszewski <brgl@bgdev.pl>
Date: Wed, 27 May 2020 11:24:04 +0200
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Applied, please use "[PATCH net-next]" to clearly indicate the target
GIT tree next time.
Thank you.
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling
@ 2020-05-27 18:25 ` David Miller
0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2020-05-27 18:25 UTC (permalink / raw)
To: brgl
Cc: stephane.leprovost, bgolaszewski, netdev, sean.wang,
linux-kernel, fparent, pedro.tsai, linux-mediatek,
andrew.perepech, john, matthias.bgg, kuba, natechancellor,
Mark-MC.Lee, linux-arm-kernel
From: Bartosz Golaszewski <brgl@bgdev.pl>
Date: Wed, 27 May 2020 11:24:04 +0200
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> The dma_addr field in desc_data must not be overwritten until after the
> new skb is mapped. Currently we do replace it with uninitialized value
> in error path. This change fixes it by moving the assignment before the
> label to which we jump after mapping or allocation errors.
>
> Fixes: 8c7bd5a454ff ("net: ethernet: mtk-star-emac: new driver")
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Applied, please use "[PATCH net-next]" to clearly indicate the target
GIT tree next time.
Thank you.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-05-27 18:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 9:24 [PATCH] net: ethernet: mtk-star-emac: fix error path in RX handling Bartosz Golaszewski
2020-05-27 9:24 ` Bartosz Golaszewski
2020-05-27 9:24 ` Bartosz Golaszewski
2020-05-27 15:54 ` Nathan Chancellor
2020-05-27 15:54 ` Nathan Chancellor
2020-05-27 15:54 ` Nathan Chancellor
2020-05-27 18:25 ` David Miller
2020-05-27 18:25 ` David Miller
2020-05-27 18:25 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.