Skip to content

Commit 3099d2e

Browse files
ayalevinSaeed Mahameed
authored andcommitted
net/mlx5e: Fix memory leak on updating vport counters
When updating statistics driver queries the vport's counters. On fail, add error path releasing the allocated buffer avoiding memory leak. Fixes: 64b68e3 ("net/mlx5: Refactor and expand rep vport stat group") Signed-off-by: Aya Levin <[email protected]> Reviewed-by: Maor Dickman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent c09502d commit 3099d2e

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)
191191
if (err) {
192192
netdev_warn(priv->netdev, "vport %d error %d reading stats\n",
193193
rep->vport, err);
194-
return;
194+
goto out;
195195
}
196196

197197
#define MLX5_GET_CTR(p, x) \
@@ -241,6 +241,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep)
241241
rep_stats->tx_vport_rdma_multicast_bytes =
242242
MLX5_GET_CTR(out, received_ib_multicast.octets);
243243

244+
out:
244245
kvfree(out);
245246
}
246247

0 commit comments

Comments
 (0)