Skip to content

Commit 352b09e

Browse files
author
Roland Dreier
committed
mlx4_core: Don't leak mailbox for SET_PORT on Ethernet ports
Commit 793730b ("mlx4_core: Don't perform SET_PORT command for Ethernet ports") introduced a leak of mailbox buffers when SET_PORT was called for Ethernet ports, since it added a return after the mailbox was allocated. Fix this by checking the port type and returning *before* allocating the mailbox. Signed-off-by: Roland Dreier <rolandd@cisco.com>
1 parent e1d60ec commit 352b09e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/mlx4/port.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,14 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
299299
struct mlx4_cmd_mailbox *mailbox;
300300
int err;
301301

302+
if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
303+
return 0;
304+
302305
mailbox = mlx4_alloc_cmd_mailbox(dev);
303306
if (IS_ERR(mailbox))
304307
return PTR_ERR(mailbox);
305308

306309
memset(mailbox->buf, 0, 256);
307-
if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
308-
return 0;
309310

310311
((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
311312
err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,

0 commit comments

Comments
 (0)