net: strparser: fix skb_head leak in strp_abort_strp()
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 net: strparser: fix skb_head leak in strp_abort_strp()
From: Luxiao Xu <[email protected]>
When the stream parser is aborted, for example after a message assembly timeout, it can still hold a reference to a partially assembled message in strp->skb_head.
That skb is not released in strp_abort_strp(), which leaks the partially assembled message and can be triggered repeatedly to exhaust memory.
Fix this by freeing strp->skb_head and resetting the parser state in the abort path. Leave strp_stop() unchanged so final cleanup still happens in strp_done() after the work and timer have been synchronized.
--- net/strparser/strparser.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/strparser/strparser.c +8 -0
@@ -45,6 +45,14 @@ static void strp_abort_strp(struct strparser *strp, int err) strp->stopped =1 ; +if (strp->skb_head) { +kfree_skb (strp->skb_head); + strp->skb_head =NULL ; + } + + strp->skb_nextp =NULL ; + strp->need_bytes =0 ; +if (strp->sk) {struct sock *sk = strp->sk;
Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Sat, 11 Apr 2026 23:10:10 +0800 you wrote:
From: Luxiao Xu <[email protected]>
When the stream parser is aborted, for example after a message assembly timeout, it can still hold a reference to a partially assembled message in
strp->skb_head.That skb is not released in
strp_abort_strp(), which leaks the partially assembled message and can be triggered repeatedly to exhaust memory.[...]
Here is the summary with links:
- [1/1] net: strparser: fix skb_head leak in strp_abort_strp()
https://git.kernel.org/netdev/net/c/fe72340daaf1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html