]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Revert "drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c"
authorJakub Kicinski <kuba@kernel.org>
Mon, 20 Jun 2022 19:12:37 +0000 (12:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jun 2022 12:15:49 +0000 (13:15 +0100)
This reverts commit 608249e205ce74071bdd564867c4fd7f067448c4.

BAR0 is the main (only?) register bank for this device. We most
obviously can't unmap it before the netdev is unregistered.
This was pointed out in review but the patch got reposted and
merged, anyway.

The author of the patch was only testing it with a QEMU model,
which I presume does not emulate enough for the netdev to be brought
up (author's replies are not visible in lore because they kept sending
their emails in HTML).

Link: https://lore.kernel.org/all/20220616085059.680dc215@kernel.org/
Fixes: 608249e205ce ("drivers/net/ethernet/neterion/vxge: Fix a use-after-free bug in vxge-main.c")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/neterion/vxge/vxge-main.c

index 092fd0ae58314111373895fbe5a187b77e5b5c1b..fa5d4ddf429b635599b0dc9744c37ec2e3fceac7 100644 (file)
@@ -4736,10 +4736,10 @@ static void vxge_remove(struct pci_dev *pdev)
        for (i = 0; i < vdev->no_of_vpath; i++)
                vxge_free_mac_add_list(&vdev->vpaths[i]);
 
-       iounmap(vdev->bar0);
        vxge_device_unregister(hldev);
        /* Do not call pci_disable_sriov here, as it will break child devices */
        vxge_hw_device_terminate(hldev);
+       iounmap(vdev->bar0);
        pci_release_region(pdev, 0);
        pci_disable_device(pdev);
        driver_config->config_dev_cnt--;