Commit b535917c authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: rtl8192e: Fix use after free in _rtl92e_pci_disconnect()

The free_rtllib() function frees the "dev" pointer so there is use
after free on the next line.  Re-arrange things to avoid that.

Fixes: 66898177 ("staging: rtl8192e: Fix unload/reload problem")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211117072016.GA5237@kiliSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ffcf7ae9
...@@ -2549,13 +2549,14 @@ static void _rtl92e_pci_disconnect(struct pci_dev *pdev) ...@@ -2549,13 +2549,14 @@ static void _rtl92e_pci_disconnect(struct pci_dev *pdev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
priv->irq = 0; priv->irq = 0;
} }
free_rtllib(dev);
if (dev->mem_start != 0) { if (dev->mem_start != 0) {
iounmap((void __iomem *)dev->mem_start); iounmap((void __iomem *)dev->mem_start);
release_mem_region(pci_resource_start(pdev, 1), release_mem_region(pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1)); pci_resource_len(pdev, 1));
} }
free_rtllib(dev);
} }
pci_disable_device(pdev); pci_disable_device(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment