6e0c7aa
From c7c35916692fe010fef25ac338443d3fe40be225 Mon Sep 17 00:00:00 2001
6e0c7aa
From: Prasad J Pandit <pjp@fedoraproject.org>
6e0c7aa
Date: Fri, 21 Oct 2016 17:39:29 +0530
6e0c7aa
Subject: [PATCH] net: rtl8139: limit processing of ring descriptors
6e0c7aa
6e0c7aa
RTL8139 ethernet controller in C+ mode supports multiple
6e0c7aa
descriptor rings, each with maximum of 64 descriptors. While
6e0c7aa
processing transmit descriptor ring in 'rtl8139_cplus_transmit',
6e0c7aa
it does not limit the descriptor count and runs forever. Add
6e0c7aa
check to avoid it.
6e0c7aa
6e0c7aa
Reported-by: Andrew Henderson <hendersa@icculus.org>
6e0c7aa
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
6e0c7aa
Signed-off-by: Jason Wang <jasowang@redhat.com>
6e0c7aa
---
6e0c7aa
 hw/net/rtl8139.c |    2 +-
6e0c7aa
 1 files changed, 1 insertions(+), 1 deletions(-)
6e0c7aa
6e0c7aa
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
6e0c7aa
index 3345bc6..f05e59c 100644
6e0c7aa
--- a/hw/net/rtl8139.c
6e0c7aa
+++ b/hw/net/rtl8139.c
6e0c7aa
@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
6e0c7aa
 {
6e0c7aa
     int txcount = 0;
6e0c7aa
 
6e0c7aa
-    while (rtl8139_cplus_transmit_one(s))
6e0c7aa
+    while (txcount < 64 && rtl8139_cplus_transmit_one(s))
6e0c7aa
     {
6e0c7aa
         ++txcount;
6e0c7aa
     }
6e0c7aa
-- 
6e0c7aa
1.7.0.4
6e0c7aa