Skip to contentSkip to conversation

net/mlx5: prevent memory leak in mlx5_fpga_conn_create_cq

PATCH Applied Navid Emamdoost 3 participants 3 messages Sep 25, 2019 – Oct 15, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: prevent memory leak in mlx5_fpga_conn_create_cq

In mlx5_fpga_conn_create_cq if mlx5_vector2eqn fails the allocated memory should be released.

---
 drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +3 -1
index 4c50efe4e7f1..61021133029e 100644
@@ -464,8 +464,10 @@ static int mlx5_fpga_conn_create_cq(struct mlx5_fpga_conn *conn, int cq_size)
 	}
 
 	err = mlx5_vector2eqn(mdev, smp_processor_id(), &eqn, &irqn);
-	if (err)
+	if (err) {
+		kvfree(in);
 		goto err_cqwq;
+	}
 
 	cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
 	MLX5_SET(cqc, cqc, log_cq_size, ilog2(cq_size));
Signature · 1 line
2.17.1
#2 lore raw
Quoted 9 lines · David Miller

From: Navid Emamdoost <[email protected]>
Date: Tue, 24 Sep 2019 22:20:34 -0500

Quoted 4 lines

In mlx5_fpga_conn_create_cq if mlx5_vector2eqn fails the allocated memory should be released.

Saeed, please queue this up.

Applied to net-mlx5 branch will send it to net branch shortly.