Skip to contentSkip to conversation

openvswitch: fix a use after free

PATCH Applied [email protected] 3 participants 3 messages Oct 17, 2014

Subsystems (3)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvswitch: fix a use after free

From: Li RongQing <[email protected]>

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

Fixes 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.")
Cc Jesse Gross <[email protected]>
Cc Eric Dumazet <[email protected]>
---
 net/openvswitch/flow.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/flow.c +2 -1
index 62db02b..c5cfc72 100644
@@ -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_available = arphdr_ok(skb);
 
 		arp = (struct arp_eth_header *)skb_network_header(skb);
 
-		if (arphdr_ok(skb) &&
+		if (arp_available &&
 		    arp->ar_hrd == htons(ARPHRD_ETHER) &&
 		    arp->ar_pro == htons(ETH_P_IP) &&
 		    arp->ar_hln == ETH_ALEN &&
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Fri, Oct 17, 2014 at 8:03 AM, <[email protected]> wrote:

From: Li RongQing <[email protected]>

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

Fixes 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.")
Cc Jesse Gross <[email protected]>
Cc Eric Dumazet <[email protected]>
maintainer Applied
#2 lore raw
In reply to [email protected]

From: [email protected]
Date: Fri, 17 Oct 2014 14:03:08 +0800

Quoted 9 lines

From: Li RongQing <[email protected]>

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

Fixes 0714812134d7d ("openvswitch: Eliminate memset() from flow_extract.")
Cc Jesse Gross <[email protected]>
Cc Eric Dumazet <[email protected]>

Applied, thanks.