Skip to content

Commit

Permalink
net/mlx4: fix some error handling in mlx4_multi_func_init()
Browse files Browse the repository at this point in the history
The while loop after err_slaves should use post-decrement; otherwise
we'll fail to do the kfrees for i==0, and will run into out-of-bounds
accesses if the setup above failed already at i==0.

[I'm not sure why one even bothers populating the ->vlan_filter array:
mlx4.h isn't #included by anything outside
drivers/net/ethernet/mellanox/mlx4/, and "git grep -C2 -w vlan_filter
drivers/net/ethernet/mellanox/mlx4/" seems to suggest that the
vlan_filter elements aren't used at all.]

Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
Villemoes authored and dledford committed Feb 11, 2016
1 parent 7425f41 commit fa51b24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx4/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
flush_workqueue(priv->mfunc.master.comm_wq);
destroy_workqueue(priv->mfunc.master.comm_wq);
err_slaves:
while (--i) {
while (i--) {
for (port = 1; port <= MLX4_MAX_PORTS; port++)
kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]);
}
Expand Down

0 comments on commit fa51b24

Please sign in to comment.