In rndis_filter_receive_data(), we need to drop the 0th page and move the
rest of pages forward if the rndis data go across page boundary, otherwise
the page offset will overflow.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
 {
        struct rndis_packet *rndis_pkt;
        u32 data_offset;
+       int i;
 
        rndis_pkt = &msg->msg.pkt;
 
        pkt->page_buf[0].offset += data_offset;
        pkt->page_buf[0].len -= data_offset;
 
+       /* Drop the 0th page, if rndis data go beyond page boundary */
+       if (pkt->page_buf[0].offset >= PAGE_SIZE) {
+               pkt->page_buf[1].offset = pkt->page_buf[0].offset - PAGE_SIZE;
+               pkt->page_buf[1].len -= pkt->page_buf[1].offset;
+               pkt->page_buf_cnt--;
+               for (i = 0; i < pkt->page_buf_cnt; i++)
+                       pkt->page_buf[i] = pkt->page_buf[i+1];
+       }
+
        pkt->is_data_pkt = true;
 
        netvsc_recv_callback(dev->net_dev->dev, pkt);