[dpdk-dev] [PATCH v2 1/7] mlx5: fix possible crash during initialization

Adrien Mazarguil adrien.mazarguil at 6wind.com
Thu Mar 3 15:27:34 CET 2016


From: Or Ami <ora at mellanox.com>

RSS configuration should not be freed when priv is NULL.

Fixes: 2f97422e7759 ("mlx5: support RSS hash update and get")

Signed-off-by: Or Ami <ora at mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst | 4 ++++
 drivers/net/mlx5/mlx5.c                | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index c69e55e..953eaa1 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -150,6 +150,10 @@ Drivers
 
 * **vmxnet3: add TSO support.**
 
+* **mlx5: Fixed possible crash during initialization.**
+
+  A crash could occur when failing to allocate private device context.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 575420e..41dcbbf 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -497,8 +497,10 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		continue;
 
 port_error:
-		rte_free(priv->rss_conf);
-		rte_free(priv);
+		if (priv) {
+			rte_free(priv->rss_conf);
+			rte_free(priv);
+		}
 		if (pd)
 			claim_zero(ibv_dealloc_pd(pd));
 		if (ctx)
-- 
2.1.4



More information about the dev mailing list