Skip to contentSkip to conversation

net: rtl8139: limit processing of ring descriptors

PATCH Applied P J P 2 participants 3 messages Oct 21, 2016 – Oct 24, 2016

lore
Share & tools
lore

P J P

author
#0 lore raw

PATCH 1/1 net: rtl8139: limit processing of ring descriptors

From: Prasad J Pandit <[email protected]>

RTL8139 ethernet controller in C+ mode supports multiple descriptor rings, each with maximum of 64 descriptors. While processing transmit descriptor ring in 'rtl8139_cplus_transmit', it does not limit the descriptor count and runs forever. Add check to avoid it.

---
 hw/net/rtl8139.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/rtl8139.c +1 -1
index 3345bc6..f05e59c 100644
@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
 {
     int txcount = 0;
 
-    while (rtl8139_cplus_transmit_one(s))
+    while (txcount < 64 && rtl8139_cplus_transmit_one(s))
     {
         ++txcount;
     }
Signature · 1 line
2.7.4
Applied
#1 lore raw
Quoted 19 lines · P J P

From: Prasad J Pandit <[email protected]>

RTL8139 ethernet controller in C+ mode supports multiple descriptor rings, each with maximum of 64 descriptors. While processing transmit descriptor ring in 'rtl8139_cplus_transmit', it does not limit the descriptor count and runs forever. Add check to avoid it.

---
  hw/net/rtl8139.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/rtl8139.c +0 -0
index 3345bc6..f05e59c 100644

hw/net/rtl8139.c static void rtl8139_cplus_transmit(RTL8139State *s) · line 2356

Quoted 8 lines
hw/net/rtl8139.c +1 -1
@@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
  {
      int txcount = 0;
 
-    while (rtl8139_cplus_transmit_one(s))
+    while (txcount < 64 && rtl8139_cplus_transmit_one(s))
      {
          ++txcount;
      }

Applied to -net, thanks.

author
#2 lore raw

Hello Jason,

+-- On Mon, 24 Oct 2016, Jason Wang wrote --+
| > RTL8139 ethernet controller in C+ mode supports multiple
| > descriptor rings, each with maximum of 64 descriptors. While
| > processing transmit descriptor ring in 'rtl8139_cplus_transmit',
| > it does not limit the descriptor count and runs forever.
| >
| > diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
| > index 3345bc6..f05e59c 100644
| > --- a/hw/net/rtl8139.c
| > +++ b/hw/net/rtl8139.c
| > @@ -2350,7 +2350,7 @@ static void rtl8139_cplus_transmit(RTL8139State *s)
| >   {
| >       int txcount = 0;
| >   -    while (rtl8139_cplus_transmit_one(s))
| > +    while (txcount < 64 && rtl8139_cplus_transmit_one(s))
| >       {
| >           ++txcount;
| >       }
| 
| Applied to -net, thanks.

Thank you. CC'ing '-stable' as it affects older versions too; Was introduced
in commit

-> git.qemu.org/?p=qemu.git;a=commit;h=49ab747f668f421138d5b40d83fa279c4

Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F