net/core: move vlan_depth out of while loop in skb_network_protocol()
Subsystems (2)
PATCH 1/1 net/core: move vlan_depth out of while loop in skb_network_protocol()
From: Li RongQing <[email protected]>
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.
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -2211,9 +2211,9 @@ EXPORT_SYMBOL(skb_checksum_help);__be16 skb_network_protocol (struct sk_buff *skb) {__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 )))
Signature · 1 line
1.7.10.4
Quoted 15 lines · On Tue, 2013-03-12 at 14:30 +0800, [email protected] wrote:
From: Li RongQing <[email protected]>
move
vlan_depthout of while loop, or elsevlan_depthalways isETH_HLEN, can not be increased, and lead to infinite loop when frame has two vlan headers.Signed-off-by Li RongQing <[email protected]>--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/dev.c +0
-0
net/core/dev.c EXPORT_SYMBOL(skb_checksum_help); · line 2219
Quoted 10 lines
net/core/dev.c +1
-1@@ -2211,9 +2211,9 @@ EXPORT_SYMBOL(skb_checksum_help);__be16 skb_network_protocol (struct sk_buff *skb) {__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 )))
Nice catch, bug added in commit 05e8ef4ab2d8087d (net: factor out skb_mac_gso_segment() from skb_gso_segment() )
So this is a patch for net tree, not for net-next.
From: Eric Dumazet <[email protected]>
Date: Tue, 12 Mar 2013 07:56:26 +0100
Quoted 25 lines · On Tue, 2013-03-12 at 14:30 +0800, [email protected] wrote:
Quoted 24 lines
From: Li RongQing <[email protected]>
move
vlan_depthout of while loop, or elsevlan_depthalways isETH_HLEN, can not be increased, and lead to infinite loop when frame has two vlan headers.Signed-off-by Li RongQing <[email protected]>--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/dev.c +1
-1@@ -2211,9 +2211,9 @@ EXPORT_SYMBOL(skb_checksum_help);__be16 skb_network_protocol (struct sk_buff *skb) {__be16 type = skb->protocol; +int vlan_depth =ETH_HLEN ;while (type ==htons (ETH_P_8021Q )) { -int vlan_depth =ETH_HLEN ;struct vlan_hdr *vh;
Quoted 8 lines
net/core/dev.c EXPORT_SYMBOL(skb_checksum_help); · line 2219
Quoted 1 line
net/core/dev.c +0
-0if (unlikely (!pskb_may_pull (skb, vlan_depth +VLAN_HLEN )))Nice catch, bug added in commit
05e8ef4ab2d8087d(net: factor outskb_mac_gso_segment()fromskb_gso_segment())So this is a patch for net tree, not for net-next.
Acked-by Eric Dumazet <[email protected]>
Applied, thanks.