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: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index ed208317..4aa0645 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -97,6 +97,12 @@
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 */
static rx_handler_result_t vrf_handle_frame(struct sk_buff **pskb)
{
@@ -149,7 +155,8 @@
static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,
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,
@@ -206,8 +213,7 @@
out:
return ret;
err:
- vrf_dev->stats.tx_errors++;
- kfree_skb(skb);
+ vrf_tx_error(vrf_dev, skb);
goto out;
}
@@ -219,6 +225,7 @@
case htons(ETH_P_IPV6):
return vrf_process_v6_outbound(skb, dev);
default:
+ vrf_tx_error(dev, skb);
return NET_XMIT_DROP;
}
}