diff mbox series

UBUNTU: SAUCE: skbuff: Release nfct refcount on napi stolen or re-used skbs

Message ID 1622130532-144451-1-git-send-email-danielj@nvidia.com
State New
Headers show
Series UBUNTU: SAUCE: skbuff: Release nfct refcount on napi stolen or re-used skbs | expand

Commit Message

Daniel Jurgens May 27, 2021, 3:48 p.m. UTC
From: Paul Blakey <paulb@nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/1929844

When multiple SKBs are merged to a new skb under napi GRO,
or SKB is re-used by napi, if nfct was set for them in the
driver, it will not be released while freeing their stolen
head state or on re-use.

Release nfct on napi's stolen or re-used SKBs.

Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT action")
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
---
 net/core/dev.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kleber Sacilotto de Souza May 27, 2021, 5:08 p.m. UTC | #1
On 27.05.21 17:48, Daniel Jurgens wrote:
> From: Paul Blakey <paulb@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1929844
> 
> When multiple SKBs are merged to a new skb under napi GRO,
> or SKB is re-used by napi, if nfct was set for them in the
> driver, it will not be released while freeing their stolen
> head state or on re-use.
> 
> Release nfct on napi's stolen or re-used SKBs.
> 
> Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT action")
> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Paul Blakey <paulb@nvidia.com>
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

This patch seems to be for focal:linux-bluefield according to its bug report.


Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

Thanks

> ---
>   net/core/dev.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index a0d7cb6..7d8f582 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5602,6 +5602,7 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)
>   
>   static void napi_skb_free_stolen_head(struct sk_buff *skb)
>   {
> +	nf_conntrack_put(skb_nfct(skb));
>   	skb_dst_drop(skb);
>   	skb_ext_put(skb);
>   	kmem_cache_free(skbuff_head_cache, skb);
> @@ -5672,6 +5673,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
>   	skb_shinfo(skb)->gso_type = 0;
>   	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
>   	skb_ext_reset(skb);
> +	nf_reset_ct(skb);
>   
>   	napi->skb = skb;
>   }
>
Tim Gardner May 27, 2021, 5:57 p.m. UTC | #2
Acked-by: Tim Gardner <tim.gardner@canonical.com>

On 5/27/21 9:48 AM, Daniel Jurgens wrote:
> From: Paul Blakey <paulb@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1929844
> 
> When multiple SKBs are merged to a new skb under napi GRO,
> or SKB is re-used by napi, if nfct was set for them in the
> driver, it will not be released while freeing their stolen
> head state or on re-use.
> 
> Release nfct on napi's stolen or re-used SKBs.
> 
> Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT action")
> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Paul Blakey <paulb@nvidia.com>
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> ---
>   net/core/dev.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index a0d7cb6..7d8f582 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5602,6 +5602,7 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)
>   
>   static void napi_skb_free_stolen_head(struct sk_buff *skb)
>   {
> +	nf_conntrack_put(skb_nfct(skb));
>   	skb_dst_drop(skb);
>   	skb_ext_put(skb);
>   	kmem_cache_free(skbuff_head_cache, skb);
> @@ -5672,6 +5673,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
>   	skb_shinfo(skb)->gso_type = 0;
>   	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
>   	skb_ext_reset(skb);
> +	nf_reset_ct(skb);
>   
>   	napi->skb = skb;
>   }
>
Daniel Jurgens May 27, 2021, 6:29 p.m. UTC | #3
> -----Original Message-----
> From: Kleber Souza <kleber.souza@canonical.com>
> Subject: ACK[focal:linux-bluefield]: [PATCH] UBUNTU: SAUCE: skbuff:
> Release nfct refcount on napi stolen or re-used skbs
> 
> On 27.05.21 17:48, Daniel Jurgens wrote:
> > From: Paul Blakey <paulb@nvidia.com>
> >
> > BugLink: https://bugs.launchpad.net/bugs/1929844
> >
> > When multiple SKBs are merged to a new skb under napi GRO, or SKB is
> > re-used by napi, if nfct was set for them in the driver, it will not
> > be released while freeing their stolen head state or on re-use.
> >
> > Release nfct on napi's stolen or re-used SKBs.
> >
> > Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT
> > action")
> > Reviewed-by: Roi Dayan <roid@nvidia.com>
> > Signed-off-by: Paul Blakey <paulb@nvidia.com>
> > Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> This patch seems to be for focal:linux-bluefield according to its bug report.
> 
> 
> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
> 

Ah, yes. I made a mistake on subject formatting. Would you like me to resubmit?

> Thanks
> 
> > ---
> >   net/core/dev.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c index a0d7cb6..7d8f582
> > 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -5602,6 +5602,7 @@ struct packet_offload
> > *gro_find_complete_by_type(__be16 type)
> >
> >   static void napi_skb_free_stolen_head(struct sk_buff *skb)
> >   {
> > +	nf_conntrack_put(skb_nfct(skb));
> >   	skb_dst_drop(skb);
> >   	skb_ext_put(skb);
> >   	kmem_cache_free(skbuff_head_cache, skb); @@ -5672,6 +5673,7
> @@
> > static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
> >   	skb_shinfo(skb)->gso_type = 0;
> >   	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
> >   	skb_ext_reset(skb);
> > +	nf_reset_ct(skb);
> >
> >   	napi->skb = skb;
> >   }
> >
Kleber Sacilotto de Souza May 28, 2021, 9:15 a.m. UTC | #4
On 27.05.21 20:29, Daniel Jurgens wrote:
> 
> 
>> -----Original Message-----
>> From: Kleber Souza <kleber.souza@canonical.com>
>> Subject: ACK[focal:linux-bluefield]: [PATCH] UBUNTU: SAUCE: skbuff:
>> Release nfct refcount on napi stolen or re-used skbs
>>
>> On 27.05.21 17:48, Daniel Jurgens wrote:
>>> From: Paul Blakey <paulb@nvidia.com>
>>>
>>> BugLink: https://bugs.launchpad.net/bugs/1929844
>>>
>>> When multiple SKBs are merged to a new skb under napi GRO, or SKB is
>>> re-used by napi, if nfct was set for them in the driver, it will not
>>> be released while freeing their stolen head state or on re-use.
>>>
>>> Release nfct on napi's stolen or re-used SKBs.
>>>
>>> Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT
>>> action")
>>> Reviewed-by: Roi Dayan <roid@nvidia.com>
>>> Signed-off-by: Paul Blakey <paulb@nvidia.com>
>>> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
>>
>> This patch seems to be for focal:linux-bluefield according to its bug report.
>>
>>
>> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
>>
> 
> Ah, yes. I made a mistake on subject formatting. Would you like me to resubmit?

No need, we can take it as-is :).


Thanks,
Kleber
Kelsey Skunberg May 29, 2021, 12:44 a.m. UTC | #5
Applied to F/bluefield master-next. thank you!

-Kelsey

On 2021-05-27 18:48:52 , Daniel Jurgens wrote:
> From: Paul Blakey <paulb@nvidia.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1929844
> 
> When multiple SKBs are merged to a new skb under napi GRO,
> or SKB is re-used by napi, if nfct was set for them in the
> driver, it will not be released while freeing their stolen
> head state or on re-use.
> 
> Release nfct on napi's stolen or re-used SKBs.
> 
> Fixes: 5c6b94604744 ("net/mlx5e: CT: Handle misses after executing CT action")
> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Paul Blakey <paulb@nvidia.com>
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> ---
>  net/core/dev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index a0d7cb6..7d8f582 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5602,6 +5602,7 @@ struct packet_offload *gro_find_complete_by_type(__be16 type)
>  
>  static void napi_skb_free_stolen_head(struct sk_buff *skb)
>  {
> +	nf_conntrack_put(skb_nfct(skb));
>  	skb_dst_drop(skb);
>  	skb_ext_put(skb);
>  	kmem_cache_free(skbuff_head_cache, skb);
> @@ -5672,6 +5673,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
>  	skb_shinfo(skb)->gso_type = 0;
>  	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
>  	skb_ext_reset(skb);
> +	nf_reset_ct(skb);
>  
>  	napi->skb = skb;
>  }
> -- 
> 1.8.3.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index a0d7cb6..7d8f582 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5602,6 +5602,7 @@  struct packet_offload *gro_find_complete_by_type(__be16 type)
 
 static void napi_skb_free_stolen_head(struct sk_buff *skb)
 {
+	nf_conntrack_put(skb_nfct(skb));
 	skb_dst_drop(skb);
 	skb_ext_put(skb);
 	kmem_cache_free(skbuff_head_cache, skb);
@@ -5672,6 +5673,7 @@  static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
 	skb_shinfo(skb)->gso_type = 0;
 	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
 	skb_ext_reset(skb);
+	nf_reset_ct(skb);
 
 	napi->skb = skb;
 }