diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2015-04-08 17:54:05 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-04-08 12:27:25 -0400 |
commit | 981a1bd85a959bb3b44e07c212ebc61c62ad7cf9 (patch) | |
tree | c7ca1f328dd70aad3fc5c80922d70c650c06b193 /drivers/net | |
parent | 8ae178fb1ce0428d1a22c36c8493bda4807ad3b8 (diff) | |
download | linux-981a1bd85a959bb3b44e07c212ebc61c62ad7cf9.tar.bz2 |
hv_netvsc: use single existing drop path in netvsc_start_xmit
... which validly uses dev_kfree_skb_any() instead of dev_kfree_skb().
Setting ret to -EFAULT and -ENOMEM have no real meaning here (we need to set
it to anything but -EAGAIN) as we drop the packet and return NETDEV_TX_OK
anyway.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index e5fa094e6fe2..9e4230d81ac0 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -370,7 +370,7 @@ not_ip: static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) { struct net_device_context *net_device_ctx = netdev_priv(net); - struct hv_netvsc_packet *packet; + struct hv_netvsc_packet *packet = NULL; int ret; unsigned int num_data_pgs; struct rndis_message *rndis_msg; @@ -396,9 +396,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) num_data_pgs = netvsc_get_slots(skb) + 2; if (num_data_pgs > MAX_PAGE_BUFFER_COUNT) { netdev_err(net, "Packet too big: %u\n", skb->len); - dev_kfree_skb(skb); - net->stats.tx_dropped++; - return NETDEV_TX_OK; + ret = -EFAULT; + goto drop; } pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE; @@ -408,9 +407,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) if (!packet) { /* out of memory, drop packet */ netdev_err(net, "unable to alloc hv_netvsc_packet\n"); - dev_kfree_skb(skb); - net->stats.tx_dropped++; - return NETDEV_TX_OK; + ret = -ENOMEM; + goto drop; } packet->part_of_skb = false; } else { @@ -574,7 +572,7 @@ drop: net->stats.tx_bytes += skb_length; net->stats.tx_packets++; } else { - if (!packet->part_of_skb) + if (packet && !packet->part_of_skb) kfree(packet); if (ret != -EAGAIN) { dev_kfree_skb_any(skb); |