[ofa-general] [PATCH] ipoib: Bug fix in ipoib_poll - resend

Eli Cohen eli at mellanox.co.il
Mon Nov 26 23:19:56 PST 2007


Bug fix in ipoib_poll

ipoib_poll may return negative values in case of errors and cause
data corruption. In addition if it returns 0 we can break the loop.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 5063dd5..d98980c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -296,6 +296,8 @@ poll_more:
 
 		t = min(IPOIB_NUM_WC, max);
 		n = ib_poll_cq(priv->cq, t, priv->ibwc);
+		if (unlikely(n < 1))
+			break;
 
 		for (i = 0; i < n; i++) {
 			struct ib_wc *wc = priv->ibwc + i;
-- 
1.5.3.6






More information about the general mailing list