]> git.baikalelectronics.ru Git - kernel.git/commitdiff
hv_netvsc: Fix the packet free when it is in skb headroom
authorHaiyang Zhang <haiyangz@microsoft.com>
Mon, 6 Apr 2015 22:22:54 +0000 (15:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Apr 2015 22:45:33 +0000 (18:45 -0400)
In the two places changed, we now use netvsc_xmit_completion() which properly
frees hv_netvsc_packet in or not in skb headroom.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c
drivers/net/hyperv/netvsc_drv.c

index 80bc52eb000c7e0500f0e6d0a9242ad9c8ed3f21..f0b8b3e0ed7cdf8387d010b4967ca9b172e2c011 100644 (file)
@@ -188,6 +188,7 @@ int netvsc_send(struct hv_device *device,
                struct hv_netvsc_packet *packet);
 void netvsc_linkstatus_callback(struct hv_device *device_obj,
                                struct rndis_message *resp);
+void netvsc_xmit_completion(void *context);
 int netvsc_recv_callback(struct hv_device *device_obj,
                        struct hv_netvsc_packet *packet,
                        struct ndis_tcp_ip_checksum_info *csum_info);
index 7e83c6ad4bb52b0bef11b054a42311016813b7a8..4d4d497d5762896d037f7c8e447451f24dac824e 100644 (file)
@@ -878,7 +878,9 @@ int netvsc_send(struct hv_device *device,
                packet->send_buf_index = section_index;
                packet->total_data_buflen += msd_len;
 
-               kfree(msdp->pkt);
+               if (msdp->pkt)
+                       netvsc_xmit_completion(msdp->pkt);
+
                if (packet->xmit_more) {
                        msdp->pkt = packet;
                        msdp->count++;
@@ -902,7 +904,7 @@ int netvsc_send(struct hv_device *device,
                if (m_ret != 0) {
                        netvsc_free_send_slot(net_device,
                                              msd_send->send_buf_index);
-                       kfree(msd_send);
+                       netvsc_xmit_completion(msd_send);
                }
        }
 
index 73f8fba62a521e69e93277834b8ef942e7c2c4c3..e5fa094e6fe20894613172afc143b5241cd94f2b 100644 (file)
@@ -229,7 +229,7 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
        return q_idx;
 }
 
-static void netvsc_xmit_completion(void *context)
+void netvsc_xmit_completion(void *context)
 {
        struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
        struct sk_buff *skb = (struct sk_buff *)