]> 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)
committerJason Wang <jasowang@redhat.com>
Tue, 9 Aug 2016 03:45:30 +0000 (11:45 +0800)
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>
hw/net/net_tx_pkt.c

index efd43b47b8a7c18d83ab14c4355a7de08f63492d..53dfaa292c102afb5896c814e34cd2e728263b3d 100644 (file)
@@ -590,7 +590,7 @@ static bool net_tx_pkt_do_sw_fragmentation(struct NetTxPkt *pkt,
 
         fragment_offset += fragment_len;
 
-    } while (more_frags);
+    } while (fragment_len && more_frags);
 
     return true;
 }