From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVD6w-00027P-7L for qemu-devel@nongnu.org; Thu, 04 Aug 2016 03:30:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVD6r-00012s-PK for qemu-devel@nongnu.org; Thu, 04 Aug 2016 03:30:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVD6r-00010f-Jy for qemu-devel@nongnu.org; Thu, 04 Aug 2016 03:30:29 -0400 From: P J P Date: Thu, 4 Aug 2016 13:00:14 +0530 Message-Id: <1470295814-28113-1-git-send-email-ppandit@redhat.com> Subject: [Qemu-devel] [PATCH v2] net: check fragment length during fragmentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu developers Cc: Li Qiang , Jason Wang , Dmitry Fleytman , Prasad J Pandit From: Prasad J Pandit 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 Signed-off-by: Prasad J Pandit --- hw/net/net_tx_pkt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Updated as per -> https://lists.gnu.org/archive/html/qemu-devel/2016-08/msg00751.html diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index efd43b4..53dfaa2 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -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; } -- 2.5.5