From: Or Ami <o...@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 4d2f76c..09afff9 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -142,6 +142,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

Reply via email to