net/mlx5: Avoid double free of root ns in the error flow path
authorParav Pandit <parav@mellanox.com>
Thu, 9 May 2019 22:23:24 +0000 (17:23 -0500)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 29 May 2019 01:25:41 +0000 (18:25 -0700)
commit905f6bd30bb6c244f97cdf5fb5d55cf263844490
tree0bc5b1f1a809a365494dfef443fdf1a3bcb96392
parent8788392995e7f1ea87d4efa03c14d872b05f9f25
net/mlx5: Avoid double free of root ns in the error flow path

When root ns setup for rdma, sniffer tx and sniffer rx fails,
such root ns cleanup is done by the error unwinding path of
mlx5_cleanup_fs().
Below call graph shows an example for sniffer_rx_root_ns.

mlx5_init_fs()
  init_sniffer_rx_root_ns()
    cleanup_root_ns(steering->sniffer_rx_root_ns);
mlx5_cleanup_fs()
  cleanup_root_ns(steering->sniffer_rx_root_ns);
  /* double free of sniffer_rx_root_ns */

Hence, use the existing cleanup_fs to cleanup.

Fixes: d83eb50e29de3 ("net/mlx5: Add support in RDMA RX steering")
Fixes: 87d22483ce68e ("net/mlx5: Add sniffer namespaces")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c