Re: [PATCH] release oob skb in __consume_stateless_skb

Philippe Gerum <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
Brandon Ho <[email protected]> writes:

> When an oob-enabled driver receives packets, those skbs are allocated
> from oob pools. The evl core may leave some of these packets to the
> regular network stack for handling based on eBPF filter criteria.
> When the regular netstack eventually consumes these skbs via
> __consume_stateless_skb, the current implementation does not release
> them back to their oob pools, causing a resource leak.
>
> This patch adds a call to skb_release_oob() in __consume_stateless_skb
> to properly return oob skbs to their pools before the standard skb
> cleanup occurs.
>
> Target kernel series v6.12.y-cip-evl-rebase.
>
> Signed-off-by: Brandon Ho <[email protected]>
> ---
>  kernel/evl/net/skb.c | 3 +++
>  net/core/skbuff.c    | 2 ++
>  2 files changed, 5 insertions(+)
>
> diff --git a/kernel/evl/net/skb.c b/kernel/evl/net/skb.c
> index 8efdca1da..302f79dfd 100644
> --- a/kernel/evl/net/skb.c
> +++ b/kernel/evl/net/skb.c
> @@ -55,6 +55,9 @@
>   *                                                -> free_skb_oob(skb)
>   *                        -> dev_kfree_skb(skb)
>   *                                -> consume_skb(skb) [1]
> + * 			  |
> + * 			    __consume_stateless_skb(skb)
> + * 						  -> free_skb_oob(skb)
>   */
>  
>  #define SKB_RECYCLING_THRESHOLD 32
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index e297781da..e08d0bc54 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1645,6 +1645,8 @@ EXPORT_SYMBOL(consume_skb);
>  void __consume_stateless_skb(struct sk_buff *skb)
>  {
>  	trace_consume_skb(skb, __builtin_return_address(0));
> +	if (skb_release_oob(skb))
> +		return;
>  	skb_release_data(skb, SKB_CONSUMED);
>  	kfree_skbmem(skb);
>  }

Merged, thanks (split between dovetail and evl trees).

-- 
Philippe.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.