net/mlx4_core: double free of dev_vfs
authorCarol L Soto <clsoto@linux.vnet.ibm.com>
Tue, 2 Jun 2015 21:07:23 +0000 (16:07 -0500)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Jun 2015 03:12:58 +0000 (20:12 -0700)
If user loads mlx4_core with num_vfs greater than
supported then variable dev->dev_vfs is freed 2 times after unloading the
driver.

Acked-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Carol L Soto <clsoto@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c

index 0dbd70427221c5ebda3d248028699b97b000a36e..9485cbef5166ce386d5c58510d1a2375ff236eb3 100644 (file)
@@ -2824,6 +2824,7 @@ disable_sriov:
 free_mem:
        dev->persist->num_vfs = 0;
        kfree(dev->dev_vfs);
+        dev->dev_vfs = NULL;
        return dev_flags & ~MLX4_FLAG_MASTER;
 }