From: Daniel Borkmann <daniel@iogearbox.net>
To: Benjamin Poirier <bpoirier@suse.com>
Cc: netdev@vger.kernel.org, Eric Dumazet <eric.dumazet@gmail.com>,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Subject: Re: [PATCH] mld, igmp: Fix reserved tailroom calculation
Date: Mon, 29 Feb 2016 16:38:30 +0100 [thread overview]
Message-ID: <56D465F6.3020802@iogearbox.net> (raw)
In-Reply-To: <20160229151920.GA5474@f1.synalogic.ca>
On 02/29/2016 04:19 PM, Benjamin Poirier wrote:
> On 2016/02/29 15:57, Daniel Borkmann wrote:
> [...]
>>
>> [ cutting the IPv4 part off as diff is the same ]
>>
>>> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
>>> index 5ee56d0..c157edc 100644
>>> --- a/net/ipv6/mcast.c
>>> +++ b/net/ipv6/mcast.c
>>> @@ -1574,9 +1574,9 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)
>>> return NULL;
>>>
>>> skb->priority = TC_PRIO_CONTROL;
>>> - skb->reserved_tailroom = skb_end_offset(skb) -
>>> - min(mtu, skb_end_offset(skb));
>>> skb_reserve(skb, hlen);
>>> + skb->reserved_tailroom = skb_tailroom(skb) -
>>> + min_t(int, mtu, skb_tailroom(skb) - tlen);
>>
>> Are you sure this is correct? Wouldn't that mean (assuming we allocated
>> enough space), that I could now fill a larger than MTU frame?
>
> Quoting back a part of the log:
>
>>> The maximum space available for ip headers and payload without
>>> fragmentation is min(mtu, data + extra). Therefore,
>>> reserved_tailroom
>>> = data + extra + tlen - min(mtu, data + extra)
>>> = skb_end_offset - hlen - min(mtu, skb_end_offset - hlen - tlen)
>>> = skb_tailroom - min(mtu, skb_tailroom - tlen) ; after skb_reserve(hlen)
>
> The min() takes care of the situation you describe, ie. if the allocated
> space is large, reserved_tailroom will be large enough that we do not
> use more space than the mtu.
Hmm, sorry, you are right, I had a bug in my thought process wrt the
skb_reserve() that is now done first.
Code is fine, patch would be against -net tree:
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Thanks, Benjamin!
next prev parent reply other threads:[~2016-02-29 15:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-27 19:57 [PATCH] mld, igmp: Fix reserved tailroom calculation Benjamin Poirier
2016-02-29 14:57 ` Daniel Borkmann
2016-02-29 15:19 ` Benjamin Poirier
2016-02-29 15:38 ` Daniel Borkmann [this message]
2016-02-29 15:43 ` Hannes Frederic Sowa
2016-02-29 18:08 ` Benjamin Poirier
2016-02-29 18:28 ` Hannes Frederic Sowa
2016-02-29 23:03 ` [PATCH net v2] " Benjamin Poirier
2016-03-01 10:09 ` Hannes Frederic Sowa
2016-03-01 10:18 ` Daniel Borkmann
2016-03-01 16:00 ` Hannes Frederic Sowa
2016-03-03 20:42 ` 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=56D465F6.3020802@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=bpoirier@suse.com \
--cc=eric.dumazet@gmail.com \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.