linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][BUG] rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter
@ 2017-07-30  8:02 Malcolm Priestley
  2017-08-03  9:34 ` [BUG] " Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Malcolm Priestley @ 2017-07-30  8:02 UTC (permalink / raw)
  To: linux-wireless; +Cc: Larry Finger, Chaoming Li, Malcolm Priestley, stable

_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>
---
Although this is the first time I have encounted this bug in 4.13-rc1
there are some historical references so I have included stable.

 drivers/net/wireless/realtek/rtlwifi/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c
index 032b6317690d..08dc8919ef60 100644
--- a/drivers/net/wireless/realtek/rtlwifi/pci.c
+++ b/drivers/net/wireless/realtek/rtlwifi/pci.c
@@ -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 @@ int rtl_pci_probe(struct pci_dev *pdev,
 	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);
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [BUG] rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter
  2017-07-30  8:02 [PATCH][BUG] rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter Malcolm Priestley
@ 2017-08-03  9:34 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2017-08-03  9:34 UTC (permalink / raw)
  To: Malcolm Priestley
  Cc: linux-wireless, Larry Finger, Chaoming Li, Malcolm Priestley,
	stable

Malcolm Priestley <tvboxspy@gmail.com> wrote:

> _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>

Patch applied to wireless-drivers-next.git, thanks.

fc81bab5eeb1 rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter

-- 
https://patchwork.kernel.org/patch/9870227/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-03  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-30  8:02 [PATCH][BUG] rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter Malcolm Priestley
2017-08-03  9:34 ` [BUG] " Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).