Skip to content
  • Parav Pandit's avatar
    net/mlx5: Avoid double free in fs init error unwinding path · 9414277a
    Parav Pandit authored
    In below code flow, for ingress acl table root ns memory leads
    to double free.
    
    mlx5_init_fs
      init_ingress_acls_root_ns()
        init_ingress_acl_root_ns
           kfree(steering->esw_ingress_root_ns);
           /* steering->esw_ingress_root_ns is not marked NULL */
      mlx5_cleanup_fs
        cleanup_ingress_acls_root_ns
           steering->esw_ingress_root_ns non NULL check passes.
           kfree(steering->esw_ingress_root_ns);
           /* double free */
    
    Similar issue exist for other tables.
    
    Hence zero out the pointers to not process the table again.
    
    Fixes: 9b93ab98
    
     ("net/mlx5: Separate ingress/egress namespaces for each vport")
    Fixes: 40c3eebb49e51 ("net/mlx5: Add support in RDMA RX steering")
    Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
    Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
    Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
    9414277a