Skip to contentSkip to conversation

net/mlx4_core: Add missed mlx4_free_cmd_mailbox()

PATCH Applied Chuhong Yuan 3 participants 3 messages Feb 21, 2021 – Feb 23, 2021

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

PATCH 1/1 net/mlx4_core: Add missed mlx4_free_cmd_mailbox()

mlx4_do_mirror_rule() forgets to call mlx4_free_cmd_mailbox() to free the memory region allocated by mlx4_alloc_cmd_mailbox() before an exit.
Add the missed call to fix it.

Fixes 78efed275117 ("net/mlx4_core: Support mirroring VF DMFS rules on both ports")
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 -0
index 394f43add85c..a99e71bc7b3c 100644
@@ -4986,6 +4986,7 @@ static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_rule
 
 	if (!fs_rule->mirr_mbox) {
 		mlx4_err(dev, "rule mirroring mailbox is null\n");
+		mlx4_free_cmd_mailbox(dev, mailbox);
 		return -EINVAL;
 	}
 	memcpy(mailbox->buf, fs_rule->mirr_mbox, fs_rule->mirr_mbox_size);
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Chuhong Yuan

mlx4_do_mirror_rule() forgets to call mlx4_free_cmd_mailbox() to free the memory region allocated by mlx4_alloc_cmd_mailbox() before an exit.
Add the missed call to fix it.

Fixes 78efed275117 ("net/mlx4_core: Support mirroring VF DMFS rules on both ports")
---
  drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 1 +
  1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +0 -0
index 394f43add85c..a99e71bc7b3c 100644

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_rule · line 4992

Quoted 7 lines
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 -0
@@ -4986,6 +4986,7 @@ static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_rule
 
  	if (!fs_rule->mirr_mbox) {
  		mlx4_err(dev, "rule mirroring mailbox is null\n");
+		mlx4_free_cmd_mailbox(dev, mailbox);
  		return -EINVAL;
  	}
  	memcpy(mailbox->buf, fs_rule->mirr_mbox, fs_rule->mirr_mbox_size);

Thanks for your patch.
Tariq

#2 lore raw
In reply to Chuhong Yuan
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 9 lines · On Sun, 21 Feb 2021 22:35:59 +0800 you wrote:

mlx4_do_mirror_rule() forgets to call mlx4_free_cmd_mailbox() to free the memory region allocated by mlx4_alloc_cmd_mailbox() before an exit.
Add the missed call to fix it.

Fixes 78efed275117 ("net/mlx4_core: Support mirroring VF DMFS rules on both ports")

[...]

Here is the summary with links:
- net/mlx4_core: Add missed mlx4_free_cmd_mailbox()

    https://git.kernel.org/netdev/net/c/8eb65fda4a6d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html