Blame SOURCES/0001-net-mlx5-fix-memory-region-cache-lookup.patch

a6040a
From 95086c654322861a10f9835233a333d7c2188df3 Mon Sep 17 00:00:00 2001
a6040a
From: Shahaf Shuler <shahafs@mellanox.com>
a6040a
Date: Thu, 25 Jan 2018 18:17:58 +0200
a6040a
Subject: [PATCH] net/mlx5: fix memory region cache lookup
a6040a
a6040a
The Memory Region (MR) cache contains pointers to mlx5_mr.
a6040a
The MR cache indexes are filled when a new MR is created. As it is
a6040a
possible for MR to be created on the flight, an extra validation must be
a6040a
added to avoid segmentation fault.
a6040a
a6040a
Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search")
a6040a
Cc: stable@dpdk.org
a6040a
a6040a
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
a6040a
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
a6040a
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
a6040a
---
a6040a
 drivers/net/mlx5/mlx5_rxtx.h | 3 ++-
a6040a
 1 file changed, 2 insertions(+), 1 deletion(-)
a6040a
a6040a
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
a6040a
index 9d9844365..f92eb33fb 100644
a6040a
--- a/drivers/net/mlx5/mlx5_rxtx.h
a6040a
+++ b/drivers/net/mlx5/mlx5_rxtx.h
a6040a
@@ -555,7 +555,8 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
a6040a
 	if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end >= addr))
a6040a
 		return txq->mp2mr[i]->lkey;
a6040a
 	for (i = 0; (i != RTE_DIM(txq->mp2mr)); ++i) {
a6040a
-		if (unlikely(txq->mp2mr[i]->mr == NULL)) {
a6040a
+		if (unlikely(txq->mp2mr[i] == NULL ||
a6040a
+		    txq->mp2mr[i]->mr == NULL)) {
a6040a
 			/* Unknown MP, add a new MR for it. */
a6040a
 			break;
a6040a
 		}
a6040a
-- 
a6040a
2.14.3
a6040a