Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195713

Re: [Question]Why a skb with frag_list causes BUG_ON in function skb_segment

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [Question]Why a skb with frag_list causes BUG_ON in function skb_segment
Date 2015-07-30 07:10 +0200
Message-ID <pROgp-5g1-3@gated-at.bofh.it> (permalink)
References <pRNDI-4hT-7@gated-at.bofh.it> <pRNDI-4hT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2015-07-30 at 12:26 +0800, Jason Wang wrote:
> cc netdev for more experts
> 
> On 07/28/2015 04:53 PM, Zhangjie (HZ) wrote:
> >
> > Hi,
> >
> > I generate a skb as follows:
> >
> > It has a linear data region, 17 frags and the last fragment is in
> > skb_shinfo(skb)->frag_list.
> >
> > Before this skb is sent to driver, dev_hard_start_xmit() will segment
> > it first(skb has frag_list,
> >
> > so we get true from netif_needs_gso()), then the skb is passed to
> > function skb_segment().
> >
> > Then, BUG_ON() happened.
> >
> > while (pos < offset + len) {
> >
> >         if (i >= nfrags) {
> >
> >                 BUG_ON(skb_headlen(list_skb));    (skbuff.c:3120)
> >
> >                 …
> >
> >         }
> >
> >         …
> >
> > }
> >
> > A skb that has no frags but frag_list also causes BUG_ON().
> >
> > I wonder if skb like follows is legal? Could skb in frag_list have
> > linear data region?

The answer is : skb_segment() is very complex but does not handle all
possible cases.

skb found in skb_shinfo(skb)->frag_list must not have anything in their
skb->head. This would require very expensive logic and memory
allocations and copies.

Make sure you follow this rule in your driver, or even better leave this
work to GRO engine.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment Jason Wang <jasowang@redhat.com> - 2015-07-30 06:30 +0200
  Re: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment Eric Dumazet <eric.dumazet@gmail.com> - 2015-07-30 07:10 +0200
    RE: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment "Zhangjie (HZ)" <zhangjie14@huawei.com> - 2015-07-30 08:00 +0200

csiph-web