]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
hyperv: Fix the total_data_buflen in send path
authorHaiyang Zhang <haiyangz@microsoft.com>
Wed, 22 Oct 2014 20:47:18 +0000 (13:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:21 +0000 (10:10 -0800)
[ Upstream commit 942396b01989d54977120f3625e5ba31afe7a75c ]

total_data_buflen is used by netvsc_send() to decide if a packet can be put
into send buffer. It should also include the size of RNDIS message before the
Ethernet frame. Otherwise, a messge with total size bigger than send_section_size
may be copied into the send buffer, and cause data corruption.

[Request to include this patch to the Stable branches]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/hyperv/netvsc_drv.c

index 0fcb5e7eb073e9eb66b2c17e53675ef87490639a..148fda3be898e304dc54e49b0977a821011193d4 100644 (file)
@@ -556,6 +556,7 @@ do_lso:
 do_send:
        /* Start filling in the page buffers with the rndis hdr */
        rndis_msg->msg_len += rndis_msg_size;
+       packet->total_data_buflen = rndis_msg->msg_len;
        packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size,
                                        skb, &packet->page_buf[0]);