Skip to content

Commit 389f489

Browse files
Li RongQingdavem330
authored andcommitted
openvswitch: fix a use after free
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: 0714812 ("openvswitch: Eliminate memset() from flow_extract.") Cc: Jesse Gross <jesse@nicira.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4062090 commit 389f489

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/openvswitch/flow.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,11 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
557557
} else if (key->eth.type == htons(ETH_P_ARP) ||
558558
key->eth.type == htons(ETH_P_RARP)) {
559559
struct arp_eth_header *arp;
560+
bool arp_available = arphdr_ok(skb);
560561

561562
arp = (struct arp_eth_header *)skb_network_header(skb);
562563

563-
if (arphdr_ok(skb) &&
564+
if (arp_available &&
564565
arp->ar_hrd == htons(ARPHRD_ETHER) &&
565566
arp->ar_pro == htons(ETH_P_IP) &&
566567
arp->ar_hln == ETH_ALEN &&

0 commit comments

Comments
 (0)