]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
net/mlx5: Avoid double free in fs init error unwinding path
authorParav Pandit <parav@mellanox.com>
Fri, 10 May 2019 15:26:23 +0000 (10:26 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
commit01a76ee067c493558589688a44d1a408f37d1a54
treee3b1ec3375cebc6fd3c4ba12f228b5dc67f9b9a0
parentc51ca6246c1ef4c609e621dfd7b66d7718ddab57
net/mlx5: Avoid double free in fs init error unwinding path

BugLink: https://bugs.launchpad.net/bugs/1837518
[ Upstream commit 9414277a5df3669c67e818708c0f881597e0118e ]

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: 9b93ab981e3bf ("net/mlx5: Separate ingress/egress namespaces for each vport")
Fixes: 40c3eebb49e51 ("net/mlx5: Add support in RDMA RX steering")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c