diff mbox series

[net-next,3/5] dpaa2-eth: fix condition for number of buffer acquire retries

Message ID 20200624113421.17360-4-ioana.ciornei@nxp.com
State Accepted
Delegated to: David Miller
Headers show
Series dpaa2-eth: small updates | expand

Commit Message

Ioana Ciornei June 24, 2020, 11:34 a.m. UTC
We should keep retrying to acquire buffers through the software portals
as long as the function returns -EBUSY and the number of retries is
__below__ DPAA2_ETH_SWP_BUSY_RETRIES.

Fixes: ef17bd7cc0c8 ("dpaa2-eth: Avoid unbounded while loops")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski June 25, 2020, 12:52 a.m. UTC | #1
On Wed, 24 Jun 2020 14:34:19 +0300 Ioana Ciornei wrote:
> We should keep retrying to acquire buffers through the software portals
> as long as the function returns -EBUSY and the number of retries is
> __below__ DPAA2_ETH_SWP_BUSY_RETRIES.
> 
> Fixes: ef17bd7cc0c8 ("dpaa2-eth: Avoid unbounded while loops")
> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>

Looks like this should be targeting net?
Ioana Ciornei June 25, 2020, 5:10 a.m. UTC | #2
> Subject: Re: [PATCH net-next 3/5] dpaa2-eth: fix condition for number of buffer
> acquire retries
> 
> On Wed, 24 Jun 2020 14:34:19 +0300 Ioana Ciornei wrote:
> > We should keep retrying to acquire buffers through the software
> > portals as long as the function returns -EBUSY and the number of
> > retries is __below__ DPAA2_ETH_SWP_BUSY_RETRIES.
> >
> > Fixes: ef17bd7cc0c8 ("dpaa2-eth: Avoid unbounded while loops")
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> Looks like this should be targeting net?

It can go into net but it can also be merged through net-next since the
bug was caught by a static analysis tool, not really seen in
practice just yet.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index db27f959d409..712bbfdbe7d7 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -1113,7 +1113,7 @@  static void drain_bufs(struct dpaa2_eth_priv *priv, int count)
 					       buf_array, count);
 		if (ret < 0) {
 			if (ret == -EBUSY &&
-			    retries++ >= DPAA2_ETH_SWP_BUSY_RETRIES)
+			    retries++ < DPAA2_ETH_SWP_BUSY_RETRIES)
 				continue;
 			netdev_err(priv->net_dev, "dpaa2_io_service_acquire() failed\n");
 			return;