net: gso_test: release each segment individually
Subsystems (2)
PATCH 1/1 net: gso_test: release each segment individually
consume_skb() doesn't walk the segment list, so segments other than the first are leaked.
Move this skb_consume call into the loop.
Cc Willem de Bruijn <[email protected]>
Fixes b3098d32ed6e ("net: add skb_segment kunit test")
Signed-off-by Florian Westphal <[email protected]>
--- net/core/gso_test.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
net/core/gso_test.c +9 -5
@@ -144,8 +144,8 @@ KUNIT_ARRAY_PARAM(gso_test, cases, gso_test_case_to_desc);static void gso_test_func (struct kunit *test) {const int shinfo_size =SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); +struct sk_buff *skb, *segs, *cur, *next, *last;const struct gso_test_case *tcase; -struct sk_buff *skb, *segs, *cur;netdev_features_t features;struct page *page;int i;
@@ -236,7 +236,10 @@ static void gso_test_func(struct kunit *test) goto free_gso_skb; } -for (cur = segs, i =0 ; cur; cur = cur->next, i++) { + last = segs->prev; +for (cur = segs, i =0 ; cur; cur = next, i++) { + next = cur->next; +KUNIT_ASSERT_EQ (test, cur->len,sizeof (hdr) + tcase->segs[i]);/* segs have skb->data pointing to the mac header */
@@ -247,13 +250,14 @@ static void gso_test_func(struct kunit *test)KUNIT_ASSERT_EQ (test,memcmp (skb_mac_header (cur), hdr,sizeof (hdr)),0 );/* last seg can be found through segs->prev pointer */ -if (!cur->next) -KUNIT_ASSERT_PTR_EQ (test, cur, segs->prev); +if (!next) +KUNIT_ASSERT_PTR_EQ (test, cur, last); + +consume_skb (cur); }KUNIT_ASSERT_EQ (test, i, tcase->nr_segs); -consume_skb (segs); free_gso_skb:consume_skb (skb); }
Signature · 1 line
2.41.0
Quoted 9 lines · Florian Westphal
consume_skb()doesn't walk the segment list, so segments other than the first are leaked.Move this
skb_consumecall into the loop.Cc Willem de Bruijn <[email protected]>Fixes b3098d32ed6e ("net: add skb_segment kunit test")Signed-off-by Florian Westphal <[email protected]>
Reviewed-by Willem de Bruijn <[email protected]>
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 10 lines · On Thu, 12 Oct 2023 14:02:37 +0200 you wrote:
consume_skb()doesn't walk the segment list, so segments other than the first are leaked.Move this
skb_consumecall into the loop.Cc Willem de Bruijn <[email protected]>Fixes b3098d32ed6e ("net: add skb_segment kunit test")Signed-off-by Florian Westphal <[email protected]>[...]
Here is the summary with links:
- [net-next] net: gso_test: release each segment individually
https://git.kernel.org/netdev/net-next/c/1b2d3b45c194
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html