netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/core: move vlan_depth out of while loop in skb_network_protocol()
@ 2013-03-12  6:30 roy.qing.li
  2013-03-12  6:56 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: roy.qing.li @ 2013-03-12  6:30 UTC (permalink / raw)
  To: netdev

From: Li RongQing <roy.qing.li@gmail.com>

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>
---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 90cee5b..35a6a6e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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)))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/core: move vlan_depth out of while loop in skb_network_protocol()
  2013-03-12  6:30 [PATCH net-next] net/core: move vlan_depth out of while loop in skb_network_protocol() roy.qing.li
@ 2013-03-12  6:56 ` Eric Dumazet
  2013-03-12 15:47   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2013-03-12  6:56 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev, Pravin B Shelar

On Tue, 2013-03-12 at 14:30 +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> 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>
> ---
>  net/core/dev.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 90cee5b..35a6a6e 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -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.

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/core: move vlan_depth out of while loop in skb_network_protocol()
  2013-03-12  6:56 ` Eric Dumazet
@ 2013-03-12 15:47   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-03-12 15:47 UTC (permalink / raw)
  To: eric.dumazet; +Cc: roy.qing.li, netdev, pshelar

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 12 Mar 2013 07:56:26 +0100

> On Tue, 2013-03-12 at 14:30 +0800, roy.qing.li@gmail.com wrote:
>> From: Li RongQing <roy.qing.li@gmail.com>
>> 
>> 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>
>> ---
>>  net/core/dev.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 90cee5b..35a6a6e 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -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.
> 
> Acked-by: Eric Dumazet <edumazet@google.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-12 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12  6:30 [PATCH net-next] net/core: move vlan_depth out of while loop in skb_network_protocol() roy.qing.li
2013-03-12  6:56 ` Eric Dumazet
2013-03-12 15:47   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).