]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net/mlx4_core: Keep only one driver entry release mlx4_priv
authorWei Yang <weiyang@linux.vnet.ibm.com>
Sun, 8 Jun 2014 10:49:46 +0000 (13:49 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Jun 2014 07:32:46 +0000 (00:32 -0700)
Following commit befdf89 "net/mlx4_core: Preserve pci_dev_data after
__mlx4_remove_one()", there are two mlx4 pci callbacks which will
attempt to release the mlx4_priv object -- .shutdown and .remove.

This leads to a use-after-free access to the already freed mlx4_priv
instance and trigger a "Kernel access of bad area" crash when both
.shutdown and .remove are called.

During reboot or kexec, .shutdown is called, with the VFs probed to
the host going through shutdown first and then the PF. Later, the PF
will trigger VFs' .remove since VFs still have driver attached.

Fix that by keeping only one driver entry which releases mlx4_priv.

Fixes: befdf89 ('net/mlx4_core: Preserve pci_dev_data after __mlx4_remove_one()')
CC: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/main.c

index 19606a44672bd06286edf0912069a9bf082238a0..703121a618e5d1c36fc7d5464e0c814b5131db11 100644 (file)
@@ -2757,7 +2757,7 @@ static struct pci_driver mlx4_driver = {
        .name           = DRV_NAME,
        .id_table       = mlx4_pci_table,
        .probe          = mlx4_init_one,
-       .shutdown       = mlx4_remove_one,
+       .shutdown       = __mlx4_remove_one,
        .remove         = mlx4_remove_one,
        .err_handler    = &mlx4_err_handler,
 };