Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94fdc2e6 authored by Jes Sorensen's avatar Jes Sorensen Committed by Kalle Valo
Browse files

orinoco: Do not call wiphy_unregister() from free_orinocodev()



alloc_orinocodev() would allocate the wiphy entry, but it would only get
registered much later in orinoco_init(). If something failed in the init
process inbetween the call to alloc_orinocodev() and the completion
of orinoco_init(), the drivers would end up calling wiphy_unregister()
with a NULL pointer causing beautiful OOPS fireworks.

Explicitly call wiphy_unregister() instead in the right places.

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent cb9d61e5
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -2321,8 +2321,6 @@ void free_orinocodev(struct orinoco_private *priv)
	struct orinoco_rx_data *rx_data, *temp;
	struct orinoco_scan_data *sd, *sdtemp;

	wiphy_unregister(wiphy);

	/* If the tasklet is scheduled when we call tasklet_kill it
	 * will run one final time. However the tasklet will only
	 * drain priv->rx_list if the hw is still available. */
+1 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ static void orinoco_cs_detach(struct pcmcia_device *link)

	orinoco_cs_release(link);

	wiphy_unregister(priv_to_wiphy(priv));
	free_orinocodev(priv);
}				/* orinoco_cs_detach */

+4 −1
Original line number Diff line number Diff line
@@ -223,13 +223,15 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,
	err = orinoco_if_add(priv, 0, 0, NULL);
	if (err) {
		printk(KERN_ERR PFX "orinoco_if_add() failed\n");
		goto fail;
		goto fail_wiphy;
	}

	pci_set_drvdata(pdev, priv);

	return 0;

 fail_wiphy:
	wiphy_unregister(priv_to_wiphy(priv));
 fail:
	free_irq(pdev->irq, priv);

@@ -263,6 +265,7 @@ static void orinoco_nortel_remove_one(struct pci_dev *pdev)
	iowrite16(0, card->bridge_io + 10);

	orinoco_if_del(priv);
	wiphy_unregister(priv_to_wiphy(priv));
	free_irq(pdev->irq, priv);
	free_orinocodev(priv);
	pci_iounmap(pdev, priv->hw.iobase);
+4 −1
Original line number Diff line number Diff line
@@ -173,13 +173,15 @@ static int orinoco_pci_init_one(struct pci_dev *pdev,
	err = orinoco_if_add(priv, 0, 0, NULL);
	if (err) {
		printk(KERN_ERR PFX "orinoco_if_add() failed\n");
		goto fail;
		goto fail_wiphy;
	}

	pci_set_drvdata(pdev, priv);

	return 0;

 fail_wiphy:
	wiphy_unregister(priv_to_wiphy(priv));
 fail:
	free_irq(pdev->irq, priv);

@@ -203,6 +205,7 @@ static void orinoco_pci_remove_one(struct pci_dev *pdev)
	struct orinoco_private *priv = pci_get_drvdata(pdev);

	orinoco_if_del(priv);
	wiphy_unregister(priv_to_wiphy(priv));
	free_irq(pdev->irq, priv);
	free_orinocodev(priv);
	pci_iounmap(pdev, priv->hw.iobase);
+4 −1
Original line number Diff line number Diff line
@@ -262,13 +262,15 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
	err = orinoco_if_add(priv, 0, 0, NULL);
	if (err) {
		printk(KERN_ERR PFX "orinoco_if_add() failed\n");
		goto fail;
		goto fail_wiphy;
	}

	pci_set_drvdata(pdev, priv);

	return 0;

 fail_wiphy:
	wiphy_unregister(priv_to_wiphy(priv));
 fail:
	free_irq(pdev->irq, priv);

@@ -299,6 +301,7 @@ static void orinoco_plx_remove_one(struct pci_dev *pdev)
	struct orinoco_pci_card *card = priv->card;

	orinoco_if_del(priv);
	wiphy_unregister(priv_to_wiphy(priv));
	free_irq(pdev->irq, priv);
	free_orinocodev(priv);
	pci_iounmap(pdev, priv->hw.iobase);
Loading