public inbox for xenomai@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] release oob skb in __consume_stateless_skb
@ 2026-03-31 22:37 Brandon Ho
  2026-04-03 12:53 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Brandon Ho @ 2026-03-31 22:37 UTC (permalink / raw)
  To: xenomai; +Cc: Brandon Ho

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 <brho@relativityspace.com>
---
 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);
 }
-- 
2.43.0


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

* Re: [PATCH] release oob skb in __consume_stateless_skb
  2026-03-31 22:37 [PATCH] release oob skb in __consume_stateless_skb Brandon Ho
@ 2026-04-03 12:53 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2026-04-03 12:53 UTC (permalink / raw)
  To: Brandon Ho; +Cc: xenomai, Brandon Ho

Brandon Ho <brandonho667@gmail.com> 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 <brho@relativityspace.com>
> ---
>  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.

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

end of thread, other threads:[~2026-04-03 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 22:37 [PATCH] release oob skb in __consume_stateless_skb Brandon Ho
2026-04-03 12:53 ` Philippe Gerum

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