aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2009-03-31 12:54:15 -0400
committerRoland Dreier <rolandd@cisco.com>2009-03-31 12:54:15 -0400
commit352b09edd7fa8145bfc9e5db0cc0fed971b69440 (patch)
treea76d32027309de5bc16b345bd74bcb0c712df07c /drivers
parente1d60ec6699f19b760df8261e922ae236ea7bb31 (diff)
mlx4_core: Don't leak mailbox for SET_PORT on Ethernet ports
Commit 793730bf ("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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/mlx4/port.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c
index 7cce3342ef8c..606aa58afdea 100644
--- a/drivers/net/mlx4/port.c
+++ b/drivers/net/mlx4/port.c
@@ -299,13 +299,14 @@ int mlx4_SET_PORT(struct mlx4_dev *dev, u8 port)
299 struct mlx4_cmd_mailbox *mailbox; 299 struct mlx4_cmd_mailbox *mailbox;
300 int err; 300 int err;
301 301
302 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
303 return 0;
304
302 mailbox = mlx4_alloc_cmd_mailbox(dev); 305 mailbox = mlx4_alloc_cmd_mailbox(dev);
303 if (IS_ERR(mailbox)) 306 if (IS_ERR(mailbox))
304 return PTR_ERR(mailbox); 307 return PTR_ERR(mailbox);
305 308
306 memset(mailbox->buf, 0, 256); 309 memset(mailbox->buf, 0, 256);
307 if (dev->caps.port_type[port] == MLX4_PORT_TYPE_ETH)
308 return 0;
309 310
310 ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port]; 311 ((__be32 *) mailbox->buf)[1] = dev->caps.ib_port_def_cap[port];
311 err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT, 312 err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_PORT,