netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: cpsw: Properly initialise struct page_pool_params
@ 2022-01-24 14:35 Toke Høiland-Jørgensen
  2022-01-24 18:51 ` Colin Foster
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-01-24 14:35 UTC (permalink / raw)
  To: Grygorii Strashko, Ilias Apalodimas, Murali Karicheri,
	David S. Miller, Jesper Dangaard Brouer, Ivan Khoronzhuk
  Cc: Toke Høiland-Jørgensen, Alexei Starovoitov,
	Colin Foster, Jakub Kicinski, linux-omap, netdev

The cpsw driver didn't properly initialise the struct page_pool_params
before calling page_pool_create(), which leads to crashes after the struct
has been expanded with new parameters.

The second Fixes tag below is where the buggy code was introduced, but
because the code was moved around this patch will only apply on top of the
commit in the first Fixes tag.

Fixes: c5013ac1dd0e ("net: ethernet: ti: cpsw: move set of common functions in cpsw_priv")
Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support")
Reported-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 drivers/net/ethernet/ti/cpsw_priv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
index ba220593e6db..8f6817f346ba 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.c
+++ b/drivers/net/ethernet/ti/cpsw_priv.c
@@ -1146,7 +1146,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv)
 static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw,
 					       int size)
 {
-	struct page_pool_params pp_params;
+	struct page_pool_params pp_params = {};
 	struct page_pool *pool;
 
 	pp_params.order = 0;
-- 
2.34.1


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

* Re: [PATCH net] net: cpsw: Properly initialise struct page_pool_params
  2022-01-24 14:35 [PATCH net] net: cpsw: Properly initialise struct page_pool_params Toke Høiland-Jørgensen
@ 2022-01-24 18:51 ` Colin Foster
  2022-01-25  5:15 ` Colin Foster
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Colin Foster @ 2022-01-24 18:51 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Grygorii Strashko, Ilias Apalodimas, Murali Karicheri,
	David S. Miller, Jesper Dangaard Brouer, Ivan Khoronzhuk,
	Alexei Starovoitov, Jakub Kicinski, linux-omap, netdev


Hi Toke,

Thanks for looking into this. I'll this patch this evening when I have
access to hardware.

Colin Foster

On Mon, Jan 24, 2022 at 03:35:29PM +0100, Toke Høiland-Jørgensen wrote:
> The cpsw driver didn't properly initialise the struct page_pool_params
> before calling page_pool_create(), which leads to crashes after the struct
> has been expanded with new parameters.
> 
> The second Fixes tag below is where the buggy code was introduced, but
> because the code was moved around this patch will only apply on top of the
> commit in the first Fixes tag.
> 
> Fixes: c5013ac1dd0e ("net: ethernet: ti: cpsw: move set of common functions in cpsw_priv")
> Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support")
> Reported-by: Colin Foster <colin.foster@in-advantage.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  drivers/net/ethernet/ti/cpsw_priv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
> index ba220593e6db..8f6817f346ba 100644
> --- a/drivers/net/ethernet/ti/cpsw_priv.c
> +++ b/drivers/net/ethernet/ti/cpsw_priv.c
> @@ -1146,7 +1146,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv)
>  static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw,
>  					       int size)
>  {
> -	struct page_pool_params pp_params;
> +	struct page_pool_params pp_params = {};
>  	struct page_pool *pool;
>  
>  	pp_params.order = 0;
> -- 
> 2.34.1
> 

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

* Re: [PATCH net] net: cpsw: Properly initialise struct page_pool_params
  2022-01-24 14:35 [PATCH net] net: cpsw: Properly initialise struct page_pool_params Toke Høiland-Jørgensen
  2022-01-24 18:51 ` Colin Foster
@ 2022-01-25  5:15 ` Colin Foster
  2022-01-25 10:22   ` Toke Høiland-Jørgensen
  2022-01-25  8:48 ` Jesper Dangaard Brouer
  2022-01-25 16:46 ` patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Colin Foster @ 2022-01-25  5:15 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Grygorii Strashko, Ilias Apalodimas, Murali Karicheri,
	David S. Miller, Jesper Dangaard Brouer, Ivan Khoronzhuk,
	Alexei Starovoitov, Jakub Kicinski, linux-omap, netdev

On Mon, Jan 24, 2022 at 03:35:29PM +0100, Toke Høiland-Jørgensen wrote:
> The cpsw driver didn't properly initialise the struct page_pool_params
> before calling page_pool_create(), which leads to crashes after the struct
> has been expanded with new parameters.
> 
> The second Fixes tag below is where the buggy code was introduced, but
> because the code was moved around this patch will only apply on top of the
> commit in the first Fixes tag.
> 
> Fixes: c5013ac1dd0e ("net: ethernet: ti: cpsw: move set of common functions in cpsw_priv")
> Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support")
> Reported-by: Colin Foster <colin.foster@in-advantage.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  drivers/net/ethernet/ti/cpsw_priv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
> index ba220593e6db..8f6817f346ba 100644
> --- a/drivers/net/ethernet/ti/cpsw_priv.c
> +++ b/drivers/net/ethernet/ti/cpsw_priv.c
> @@ -1146,7 +1146,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv)
>  static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw,
>  					       int size)
>  {
> -	struct page_pool_params pp_params;
> +	struct page_pool_params pp_params = {};
>  	struct page_pool *pool;
>  
>  	pp_params.order = 0;
> -- 
> 2.34.1
> 

Works for me. Thanks Toke! Hopefully my tested by tag addition is done
correctly:

Tested-by: Colin Foster <colin.foster@in-advantage.com>



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

* Re: [PATCH net] net: cpsw: Properly initialise struct page_pool_params
  2022-01-24 14:35 [PATCH net] net: cpsw: Properly initialise struct page_pool_params Toke Høiland-Jørgensen
  2022-01-24 18:51 ` Colin Foster
  2022-01-25  5:15 ` Colin Foster
@ 2022-01-25  8:48 ` Jesper Dangaard Brouer
  2022-01-25 16:46 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Jesper Dangaard Brouer @ 2022-01-25  8:48 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Grygorii Strashko,
	Ilias Apalodimas, Murali Karicheri, David S. Miller,
	Ivan Khoronzhuk
  Cc: brouer, Alexei Starovoitov, Colin Foster, Jakub Kicinski,
	linux-omap, netdev



On 24/01/2022 15.35, Toke Høiland-Jørgensen wrote:
> The cpsw driver didn't properly initialise the struct page_pool_params
> before calling page_pool_create(), which leads to crashes after the struct
> has been expanded with new parameters.
> 
> The second Fixes tag below is where the buggy code was introduced, but
> because the code was moved around this patch will only apply on top of the
> commit in the first Fixes tag.
> 
> Fixes: c5013ac1dd0e ("net: ethernet: ti: cpsw: move set of common functions in cpsw_priv")
> Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support")
> Reported-by: Colin Foster <colin.foster@in-advantage.com>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>


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

* Re: [PATCH net] net: cpsw: Properly initialise struct page_pool_params
  2022-01-25  5:15 ` Colin Foster
@ 2022-01-25 10:22   ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2022-01-25 10:22 UTC (permalink / raw)
  To: Colin Foster
  Cc: Grygorii Strashko, Ilias Apalodimas, Murali Karicheri,
	David S. Miller, Jesper Dangaard Brouer, Ivan Khoronzhuk,
	Alexei Starovoitov, Jakub Kicinski, linux-omap, netdev

Colin Foster <colin.foster@in-advantage.com> writes:

> On Mon, Jan 24, 2022 at 03:35:29PM +0100, Toke Høiland-Jørgensen wrote:
>> The cpsw driver didn't properly initialise the struct page_pool_params
>> before calling page_pool_create(), which leads to crashes after the struct
>> has been expanded with new parameters.
>> 
>> The second Fixes tag below is where the buggy code was introduced, but
>> because the code was moved around this patch will only apply on top of the
>> commit in the first Fixes tag.
>> 
>> Fixes: c5013ac1dd0e ("net: ethernet: ti: cpsw: move set of common functions in cpsw_priv")
>> Fixes: 9ed4050c0d75 ("net: ethernet: ti: cpsw: add XDP support")
>> Reported-by: Colin Foster <colin.foster@in-advantage.com>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  drivers/net/ethernet/ti/cpsw_priv.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
>> index ba220593e6db..8f6817f346ba 100644
>> --- a/drivers/net/ethernet/ti/cpsw_priv.c
>> +++ b/drivers/net/ethernet/ti/cpsw_priv.c
>> @@ -1146,7 +1146,7 @@ int cpsw_fill_rx_channels(struct cpsw_priv *priv)
>>  static struct page_pool *cpsw_create_page_pool(struct cpsw_common *cpsw,
>>  					       int size)
>>  {
>> -	struct page_pool_params pp_params;
>> +	struct page_pool_params pp_params = {};
>>  	struct page_pool *pool;
>>  
>>  	pp_params.order = 0;
>> -- 
>> 2.34.1
>> 
>
> Works for me. Thanks Toke! Hopefully my tested by tag addition is done
> correctly:
>
> Tested-by: Colin Foster <colin.foster@in-advantage.com>

You're welcome! Tag looks good, thanks for testing :)

-Toke


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

* Re: [PATCH net] net: cpsw: Properly initialise struct page_pool_params
  2022-01-24 14:35 [PATCH net] net: cpsw: Properly initialise struct page_pool_params Toke Høiland-Jørgensen
                   ` (2 preceding siblings ...)
  2022-01-25  8:48 ` Jesper Dangaard Brouer
@ 2022-01-25 16:46 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-25 16:46 UTC (permalink / raw)
  To: =?utf-8?b?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2VuIDx0b2tlQHJlZGhhdC5jb20+?=
  Cc: grygorii.strashko, ilias.apalodimas, m-karicheri2, davem, brouer,
	ivan.khoronzhuk, alexei.starovoitov, colin.foster, kuba,
	linux-omap, netdev

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 24 Jan 2022 15:35:29 +0100 you wrote:
> The cpsw driver didn't properly initialise the struct page_pool_params
> before calling page_pool_create(), which leads to crashes after the struct
> has been expanded with new parameters.
> 
> The second Fixes tag below is where the buggy code was introduced, but
> because the code was moved around this patch will only apply on top of the
> commit in the first Fixes tag.
> 
> [...]

Here is the summary with links:
  - [net] net: cpsw: Properly initialise struct page_pool_params
    https://git.kernel.org/netdev/net/c/c63003e3d997

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-01-25 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 14:35 [PATCH net] net: cpsw: Properly initialise struct page_pool_params Toke Høiland-Jørgensen
2022-01-24 18:51 ` Colin Foster
2022-01-25  5:15 ` Colin Foster
2022-01-25 10:22   ` Toke Høiland-Jørgensen
2022-01-25  8:48 ` Jesper Dangaard Brouer
2022-01-25 16:46 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).