Skip to content

Commit

Permalink
net/core: move vlan_depth out of while loop in skb_network_protocol()
Browse files Browse the repository at this point in the history
[ Bug added added in commit 05e8ef4 (net: factor out
  skb_mac_gso_segment() from skb_gso_segment() ) ]

move vlan_depth out of while loop, or else vlan_depth always is ETH_HLEN,
can not be increased, and lead to infinite loop when frame has two vlan headers.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Li RongQing authored and David S. Miller committed Mar 12, 2013
1 parent 45549a6 commit c80a851
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2219,9 +2219,9 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
struct packet_offload *ptype;
__be16 type = skb->protocol;
int vlan_depth = ETH_HLEN;

while (type == htons(ETH_P_8021Q)) {
int vlan_depth = ETH_HLEN;
struct vlan_hdr *vh;

if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN)))
Expand Down

0 comments on commit c80a851

Please sign in to comment.