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