[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150312.182558.447886504045770209.davem@davemloft.net>
Date: Thu, 12 Mar 2015 18:25:58 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: ebiederm@...ssion.com
Cc: rshearma@...cade.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next ] mpls: In mpls_egress verify the packet
length.
From: ebiederm@...ssion.com (Eric W. Biederman)
Date: Thu, 12 Mar 2015 15:54:52 -0500
> Robert Shearman noticed that mpls_egress is failing to verify that
> the bytes to be examined are in fact present in the packet before
> mpls_egress reads those bytes.
>
> Reported-by: Robert Shearman <rshearma@...cade.com>
> Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
Let's see if we can consolidate these pskb_may_pull() calls into one,
in the fast path they are relatively cheap but not zero cost.
The caller (mpls_forward()) is doing one as well.
All you care about is the version field and the hop_limit/ttl.
For ipv4, version is in byte 0, and ttl is in byte 9.
For ipv6, version is also in byte zero and hop_limit is in byte 7.
Therefore if you do pskb_may_pull(skb, 10) it will cover all cases
whilst not exceeding the size of either protocol's total header.
Above the pskb_may_pull() call can add a big comment explaining what
you are doing and why this is sufficient.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists