Recent patch [1] added, at the end of mlx5_dev_configure(), a call to
mlx5_proc_priv_init(), initializing process_private data of eth_dev.
This call is not reached if PMD is started with zero Rx queues.
In this case mlx5_dev_configure() returns earlier due to the check:
        if (rxqs_n == priv->rxqs_n)
                return 0;
In such a scenario, later references to uninitialized process_private
data will result in segmentation fault.
For example see in function txq_uar_init().

This patch moves the call to mlx5_proc_priv_init() to location above
the check, to ensure process_private data is initialized.

[1] http://patches.dpdk.org/patch/52629/

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: ys...@mellanox.com

Signed-off-by: Dekel Peled <dek...@mellanox.com>
Acked-by: Yongseok Koh <ys...@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 0845b02..160b307 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -423,6 +423,9 @@ struct ethtool_link_settings {
                        dev->data->port_id, priv->txqs_n, txqs_n);
                priv->txqs_n = txqs_n;
        }
+       ret = mlx5_proc_priv_init(dev);
+       if (ret)
+               return ret;
        if (rxqs_n > priv->config.ind_table_max_size) {
                DRV_LOG(ERR, "port %u cannot handle this many Rx queues (%u)",
                        dev->data->port_id, rxqs_n);
@@ -464,9 +467,6 @@ struct ethtool_link_settings {
                if (++j == rxqs_n)
                        j = 0;
        }
-       ret = mlx5_proc_priv_init(dev);
-       if (ret)
-               return ret;
        return 0;
 }
 
-- 
1.8.3.1

Reply via email to