Commit b48f7183 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

commit fc81bab5 upstream.

_rtl_pci_find_adapter fail path will jump to label fail3 for
unsupported adapter types.

However, on course for fail3 there will be call rtl_deinit_core
before rtl_init_core.

For the inclusion of checking pci_iounmap this fail can be moved to
fail2.

Fixes
[    4.492963] BUG: unable to handle kernel NULL pointer dereference at           (null)
[    4.493067] IP: rtl_deinit_core+0x31/0x90 [rtlwifi]
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed7a384a
...@@ -2269,7 +2269,7 @@ int rtl_pci_probe(struct pci_dev *pdev, ...@@ -2269,7 +2269,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
/* find adapter */ /* find adapter */
if (!_rtl_pci_find_adapter(pdev, hw)) { if (!_rtl_pci_find_adapter(pdev, hw)) {
err = -ENODEV; err = -ENODEV;
goto fail3; goto fail2;
} }
/* Init IO handler */ /* Init IO handler */
...@@ -2339,10 +2339,10 @@ int rtl_pci_probe(struct pci_dev *pdev, ...@@ -2339,10 +2339,10 @@ int rtl_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
rtl_deinit_core(hw); rtl_deinit_core(hw);
fail2:
if (rtlpriv->io.pci_mem_start != 0) if (rtlpriv->io.pci_mem_start != 0)
pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
fail2:
pci_release_regions(pdev); pci_release_regions(pdev);
complete(&rtlpriv->firmware_loading_complete); complete(&rtlpriv->firmware_loading_complete);
......
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