]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter
authorMalcolm Priestley <tvboxspy@gmail.com>
Sun, 30 Jul 2017 08:02:19 +0000 (09:02 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 3 Aug 2017 09:32:27 +0000 (12:32 +0300)
_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: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/pci.c

index 032b6317690d3f65609f5c37ea2bab8c2b353cf2..08dc8919ef60e213b8fa34ad30378fc94168cc2a 100644 (file)
@@ -2257,7 +2257,7 @@ int rtl_pci_probe(struct pci_dev *pdev,
        /* find adapter */
        if (!_rtl_pci_find_adapter(pdev, hw)) {
                err = -ENODEV;
-               goto fail3;
+               goto fail2;
        }
 
        /* Init IO handler */
@@ -2318,10 +2318,10 @@ fail3:
        pci_set_drvdata(pdev, NULL);
        rtl_deinit_core(hw);
 
+fail2:
        if (rtlpriv->io.pci_mem_start != 0)
                pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
 
-fail2:
        pci_release_regions(pdev);
        complete(&rtlpriv->firmware_loading_complete);