From: Eric Dumazet <eric.dumazet@gmail.com>
To: Yonghong Song <yhs@fb.com>,
edumazet@google.com, ast@fb.com, daniel@iogearbox.net,
diptanu@fb.com, netdev@vger.kernel.org
Cc: kernel-team@fb.com
Subject: Re: [PATCH net-next v4 2/2] net: bpf: add a test for skb_segment in test_bpf module
Date: Wed, 21 Mar 2018 08:26:20 -0700 [thread overview]
Message-ID: <435477a4-bf2d-f710-a1a0-f1957eb01f7a@gmail.com> (raw)
In-Reply-To: <20180321064722.1411857-3-yhs@fb.com>
On 03/20/2018 11:47 PM, Yonghong Song wrote:
> +static __init int test_skb_segment(void)
> +{
> + netdev_features_t features;
> + struct sk_buff *skb;
> + int ret = -1;
> +
> + features = NETIF_F_SG | NETIF_F_GSO_PARTIAL | NETIF_F_IP_CSUM |
> + NETIF_F_IPV6_CSUM;
> + features |= NETIF_F_RXCSUM;
> + skb = build_test_skb();
> + if (!skb) {
> + pr_info("%s: failed to build_test_skb", __func__);
> + goto done;
> + }
> +
> + if (skb_segment(skb, features)) {
> + ret = 0;
> + pr_info("%s: success in skb_segment!", __func__);
> + } else {
> + pr_info("%s: failed in skb_segment!", __func__);
> + }
> + kfree_skb(skb);
If skb_segmen() was successful (original) skb was already freed.
kfree_skb(old_skb) should thus panic the box, if you run this code
on a kernel having some debugging features like KASAN
So you must store in a variable the return of skb_segment(),
to be able to free skb(s), using kfree_skb_list()
> +done:
> + return ret;
> +}
> +
next prev parent reply other threads:[~2018-03-21 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 6:47 [PATCH net-next v4 0/2] net: permit skb_segment on head_frag frag_list skb Yonghong Song
2018-03-21 6:47 ` [PATCH net-next v4 1/2] " Yonghong Song
2018-03-21 6:47 ` [PATCH net-next v4 2/2] net: bpf: add a test for skb_segment in test_bpf module Yonghong Song
2018-03-21 15:03 ` Eric Dumazet
2018-03-21 15:26 ` Eric Dumazet [this message]
2018-03-21 20:15 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=435477a4-bf2d-f710-a1a0-f1957eb01f7a@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=diptanu@fb.com \
--cc=edumazet@google.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).