[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOrHB_CJBSyuZ1EV0gMkckEvmDhxqDpXGgj55VXfAn+YjuWAOQ@mail.gmail.com>
Date: Tue, 20 Sep 2016 10:12:35 -0700
From: pravin shelar <pshelar@....org>
To: Shmulik Ladkani <shmulik.ladkani@...ellosystems.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jiri Pirko <jiri@...lanox.com>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <eric.dumazet@...il.com>,
Linux Kernel Network Developers <netdev@...r.kernel.org>,
Shmulik Ladkani <shmulik.ladkani@...il.com>
Subject: Re: [PATCH v3 net-next 1/2] net: skbuff: Remove errornous length
validation in skb_vlan_pop()
On Tue, Sep 20, 2016 at 2:48 AM, Shmulik Ladkani
<shmulik.ladkani@...ellosystems.com> wrote:
> In 93515d53b1
> "net: move vlan pop/push functions into common code"
> skb_vlan_pop was moved from its private location in openvswitch to
> skbuff common code.
>
> In case skb has non hw-accel vlan tag, the original 'pop_vlan()' assured
> that skb->len is sufficient (if skb->len < VLAN_ETH_HLEN then pop was
> considered a no-op).
>
> This validation was moved as is into the new common 'skb_vlan_pop'.
>
> Alas, in its original location (openvswitch), there was a guarantee that
> 'data' points to the mac_header, therefore the 'skb->len < VLAN_ETH_HLEN'
> condition made sense.
> However there's no such guarantee in the generic 'skb_vlan_pop'.
>
> For short packets received in rx path going through 'skb_vlan_pop',
> this causes 'skb_vlan_pop' to fail pop-ing a valid vlan hdr (in the non
> hw-accel case) or to fail moving next tag into hw-accel tag.
>
> Remove the 'skb->len < VLAN_ETH_HLEN' condition entirely:
> It is superfluous since inner '__skb_vlan_pop' already verifies there
> are VLAN_ETH_HLEN writable bytes at the mac_header.
>
> Note this presents a slight change to skb_vlan_pop() users:
> In case total length is smaller than VLAN_ETH_HLEN, skb_vlan_pop() now
> returns an error, as opposed to previous "no-op" behavior.
> Existing callers (e.g. tc act vlan, ovs) usually drop the packet if
> 'skb_vlan_pop' fails.
>
> Fixes: 93515d53b1 ("net: move vlan pop/push functions into common code")
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@...il.com>
> Cc: Pravin Shelar <pshelar@....org>
> ---
> v3: Elaborate log message to explain the change presented to
> 'skb_vlan_pop' users for packets smaller than VLAN_ETH_HLEN
>
> v2: Remove 'skb->len < VLAN_ETH_HLEN' condition entirely (instead of
> testing skb->mac_len as was in v1), suggested by Pravin Shelar
>
> net/core/skbuff.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
Reviewed-by: Pravin B Shelar <pshelar@....org>
Powered by blists - more mailing lists