]> Git Repo - linux.git/commitdiff
net/mlx4: fix some error handling in mlx4_multi_func_init()
authorRasmus Villemoes <[email protected]>
Tue, 9 Feb 2016 20:11:14 +0000 (21:11 +0100)
committerDoug Ledford <[email protected]>
Thu, 11 Feb 2016 16:04:54 +0000 (11:04 -0500)
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]>
drivers/net/ethernet/mellanox/mlx4/cmd.c

index d48d5793407d9ec729fe8548a049a2506d02a934..e94ca1c3fc7c6a83a190a29d4116086dcc9de8ca 100644 (file)
@@ -2429,7 +2429,7 @@ err_thread:
        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]);
        }
This page took 0.065482 seconds and 4 git commands to generate.