net: stmmac: Prevent infinite loop in get_rx_timestamp_status()
authorJose Abreu <Jose.Abreu@synopsys.com>
Fri, 20 Oct 2017 13:37:36 +0000 (14:37 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Oct 2017 01:50:40 +0000 (02:50 +0100)
Prevent infinite loop by correctly setting the loop condition to
break when i == 10.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c

index e0ef02f9503bae027268b1b058f9875b6c1365a7..4b286e27c4ca5cdbbb7c457e31bef1b2e9e7bd94 100644 (file)
@@ -275,7 +275,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats)
                                        goto exit;
                                i++;
 
-                       } while ((ret == 1) || (i < 10));
+                       } while ((ret == 1) && (i < 10));
 
                        if (i == 10)
                                ret = -EBUSY;