net/mlx4_core: Fix memory leak while delete slave's resources
authorMoshe Shemesh <moshe@mellanox.com>
Tue, 27 Mar 2018 11:41:19 +0000 (14:41 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 16:02:30 +0000 (12:02 -0400)
mlx4_delete_all_resources_for_slave in resource tracker should free all
memory allocated for a slave.
While releasing memory of fs_rule, it misses releasing memory of
fs_rule->mirr_mbox.

Fixes: 78efed275117 ('net/mlx4_core: Support mirroring VF DMFS rules on both ports')
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c

index 606a0e0beeae6961ae4e8c7a357d737834be614e..29e50f787349c986cdb8b954c783b54efeab770f 100644 (file)
@@ -5088,6 +5088,7 @@ static void rem_slave_fs_rule(struct mlx4_dev *dev, int slave)
                                                 &tracker->res_tree[RES_FS_RULE]);
                                        list_del(&fs_rule->com.list);
                                        spin_unlock_irq(mlx4_tlock(dev));
+                                       kfree(fs_rule->mirr_mbox);
                                        kfree(fs_rule);
                                        state = 0;
                                        break;