From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tom Herbert <therbert@google.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>
Subject: Re: Bug in computing data_len in tcp_sendmsg?
Date: Thu, 01 Dec 2011 05:17:12 +0100 [thread overview]
Message-ID: <1322713032.2577.7.camel@edumazet-laptop> (raw)
In-Reply-To: <CA+mtBx_CUsuGunKONwBNA8qyVni16+RtrRL8w=THYY0mEDcvaA@mail.gmail.com>
Le mercredi 30 novembre 2011 à 20:06 -0800, Tom Herbert a écrit :
> On Wed, Nov 30, 2011 at 7:42 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Le mercredi 30 novembre 2011 à 17:48 -0800, Tom Herbert a écrit :
> >> I believe that skb->data_len might no be computed correctly in
> >> tcp_sendmsg. Specifically, when skb_add_data_nocache (or
> >> skb_add_data) is called skb->data_len is not updated (skb_put only
> >> updates skb->len). This results in the datalen in the head skbuf
> >> being zero so any subsequent uses of the value lead to incorrect
> >> results. For instance, skb_headlen returns the length of the head
> >> skbu data and not just that of the headers. If I'm reading this
> >> correctly, it's a pretty fundamental bug.
> >>
> >> I don't have a fix for this yet.
> >>
> >> Tom
> >
> > On which tree do you see a problem ?
> >
> > For example net-next seems fine to me :
> >
> >
>
> On net-next. Look at skb_add_data_nocache. This doesn't touch
> data_len, and really can't since skb_put wants skb linearized.
>
> Actually, I think I am misinterpreting the meaning of data_len, looks
> like it is intended to return the number of bytes in the page buffer
> area (comment on the function would be have been nice ;-) ). It would
> seem that e1000e driver might be misinterpreting it also:
>
> segs = skb_shinfo(skb)->gso_segs ? : 1;
> /* multiply data chunks by size of headers */
> bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len;
>
> So maybe the bug is that e1000e is misusing the function (and it
> looks like some other drivers would be too)?.
Or the "bug" was to assume that skb was headless.
It was true until recently.
We recently added commit f07d960df33c5aef
(tcp: avoid frag allocation for small frames)
to avoid page allocation for small frames.
So now, skb can contain in head part of tcp data.
next prev parent reply other threads:[~2011-12-01 4:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 1:48 Bug in computing data_len in tcp_sendmsg? Tom Herbert
2011-12-01 3:42 ` Eric Dumazet
2011-12-01 4:06 ` Tom Herbert
2011-12-01 4:16 ` David Miller
2011-12-01 4:17 ` Eric Dumazet [this message]
2011-12-01 5:09 ` Tom Herbert
2011-12-01 9:15 ` Eric Dumazet
2011-12-01 17:29 ` Jesse Brandeburg
2011-12-01 18:04 ` David Miller
2011-12-01 20:37 ` Eric Dumazet
2011-12-01 22:18 ` Vijay Subramanian
2011-12-01 22:30 ` Eric Dumazet
2011-12-02 6:18 ` Vijay Subramanian
2011-12-02 11:59 ` Eric Dumazet
2011-12-02 15:44 ` Eric Dumazet
2011-12-02 16:05 ` Eric Dumazet
2011-12-02 18:13 ` David Miller
2011-12-02 18:36 ` Eric Dumazet
2011-12-02 18:40 ` David Miller
2011-12-02 20:22 ` Eric Dumazet
2011-12-02 20:24 ` David Miller
2011-12-02 20:45 ` Eric Dumazet
2011-12-02 20:48 ` Eric Dumazet
2011-12-02 21:30 ` David Miller
2011-12-03 15:09 ` Eric Dumazet
2011-12-04 7:39 ` [PATCH] tcp: take care of misalignments Eric Dumazet
2011-12-04 18:21 ` David Miller
2011-12-04 18:51 ` Eric Dumazet
2011-12-05 23:45 ` David Miller
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=1322713032.2577.7.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.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