[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1413468747.28798.19.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 16 Oct 2014 07:12:27 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: roy.qing.li@...il.com
Cc: netdev@...r.kernel.org, Jesse Gross <jesse@...ira.com>,
Andy Zhou <azhou@...ira.com>,
Pravin B Shelar <pshelar@...ira.com>
Subject: Re: [PATCH] openvswitch: fix a use after free
On Thu, 2014-10-16 at 17:01 +0800, roy.qing.li@...il.com wrote:
> From: Li RongQing <roy.qing.li@...il.com>
>
> pskb_may_pull() called by arphdr_ok can change skb->data, so put the arp
> setting after arphdr_ok to avoid the use the freed memory
>
> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
> ---
> net/openvswitch/flow.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> index 62db02b..b13ba5e 100644
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> @@ -557,10 +557,11 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
> } else if (key->eth.type == htons(ETH_P_ARP) ||
> key->eth.type == htons(ETH_P_RARP)) {
> struct arp_eth_header *arp;
> + bool arp_t = arphdr_ok(skb);
This is a strange name for a bool. _t suffix is normally used by
typedef.
>
> arp = (struct arp_eth_header *)skb_network_header(skb);
>
> - if (arphdr_ok(skb) &&
> + if (arp_t &&
> arp->ar_hrd == htons(ARPHRD_ETHER) &&
> arp->ar_pro == htons(ETH_P_IP) &&
> arp->ar_hln == ETH_ALEN &&
Fixes: 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.")
By doing this bug hunting, you also can CC bug author so that he knows
what happened. Maybe he will avoid similar mistakes in the future.
--
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