]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
net: check fragment length during fragmentation
authorPrasad J Pandit <pjp@fedoraproject.org>
Thu, 4 Aug 2016 07:30:14 +0000 (13:00 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 8 Sep 2016 19:42:28 +0000 (14:42 -0500)
Network transport abstraction layer supports packet fragmentation.
While fragmenting a packet, it checks for more fragments from
packet length and current fragment length. It is susceptible
to an infinite loop, if the current fragment length is zero.
Add check to avoid it.

Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit ead315e43ea0c2ca3491209c6c8db8ce3f2bbe05)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/net/vmxnet_tx_pkt.c

index 91e1e08fd948813af954bfa803a51312dd2afa25..f4d0f5f15a91f90b5aa0f4555d3537589c0c4500 100644 (file)
@@ -544,7 +544,7 @@ static bool vmxnet_tx_pkt_do_sw_fragmentation(struct VmxnetTxPkt *pkt,
 
         fragment_offset += fragment_len;
 
-    } while (more_frags);
+    } while (fragment_len && more_frags);
 
     return true;
 }