Commit 57b8efa1 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

vrf: plug skb leaks

Currently whenever a packet different from ETH_P_IP is sent through the
VRF device it is leaked so plug the leaks and properly drop these
packets.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 18041e31
...@@ -97,6 +97,12 @@ static bool is_ip_rx_frame(struct sk_buff *skb) ...@@ -97,6 +97,12 @@ static bool is_ip_rx_frame(struct sk_buff *skb)
return false; return false;
} }
static void vrf_tx_error(struct net_device *vrf_dev, struct sk_buff *skb)
{
vrf_dev->stats.tx_errors++;
kfree_skb(skb);
}
/* note: already called with rcu_read_lock */ /* note: already called with rcu_read_lock */
static rx_handler_result_t vrf_handle_frame(struct sk_buff **pskb) static rx_handler_result_t vrf_handle_frame(struct sk_buff **pskb)
{ {
...@@ -149,7 +155,8 @@ static struct rtnl_link_stats64 *vrf_get_stats64(struct net_device *dev, ...@@ -149,7 +155,8 @@ static struct rtnl_link_stats64 *vrf_get_stats64(struct net_device *dev,
static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb, static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
return 0; vrf_tx_error(dev, skb);
return NET_XMIT_DROP;
} }
static int vrf_send_v4_prep(struct sk_buff *skb, struct flowi4 *fl4, static int vrf_send_v4_prep(struct sk_buff *skb, struct flowi4 *fl4,
...@@ -206,8 +213,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb, ...@@ -206,8 +213,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
out: out:
return ret; return ret;
err: err:
vrf_dev->stats.tx_errors++; vrf_tx_error(vrf_dev, skb);
kfree_skb(skb);
goto out; goto out;
} }
...@@ -219,6 +225,7 @@ static netdev_tx_t is_ip_tx_frame(struct sk_buff *skb, struct net_device *dev) ...@@ -219,6 +225,7 @@ static netdev_tx_t is_ip_tx_frame(struct sk_buff *skb, struct net_device *dev)
case htons(ETH_P_IPV6): case htons(ETH_P_IPV6):
return vrf_process_v6_outbound(skb, dev); return vrf_process_v6_outbound(skb, dev);
default: default:
vrf_tx_error(dev, skb);
return NET_XMIT_DROP; return NET_XMIT_DROP;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment