Skip to content

Commit

Permalink
ipv4: fix reply_dst leakage on arp reply
Browse files Browse the repository at this point in the history
There are cases when the created metadata reply is not used. Ensure the
allocated memory is freed also in such cases.

Fixes: 63d008a ("ipv4: send arp replies to the correct tunnel")
Reported-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: Jiri Benc <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jiri Benc authored and davem330 committed Oct 5, 2015
1 parent 2306c70 commit 181a422
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static void arp_send_dst(int type, int ptype, __be32 dest_ip,
if (!skb)
return;

skb_dst_set(skb, dst);
skb_dst_set(skb, dst_clone(dst));
arp_xmit(skb);
}

Expand Down Expand Up @@ -384,7 +384,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
}

if (skb && !(dev->priv_flags & IFF_XMIT_DST_RELEASE))
dst = dst_clone(skb_dst(skb));
dst = skb_dst(skb);
arp_send_dst(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
dst_hw, dev->dev_addr, NULL, dst);
}
Expand Down Expand Up @@ -811,7 +811,7 @@ static int arp_process(struct sock *sk, struct sk_buff *skb)
} else {
pneigh_enqueue(&arp_tbl,
in_dev->arp_parms, skb);
return 0;
goto out_free_dst;
}
goto out;
}
Expand Down Expand Up @@ -865,6 +865,8 @@ static int arp_process(struct sock *sk, struct sk_buff *skb)

out:
consume_skb(skb);
out_free_dst:
dst_release(reply_dst);
return 0;
}

Expand Down

0 comments on commit 181a422

Please sign in to comment.