aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hp100.c
diff options
context:
space:
mode:
author <herbert@gondor.apana.org.au>2005-05-12 20:11:55 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-05-12 20:11:55 -0400
commitb1fc5505e0dbcc3fd7c75bfe6bee39ec50080963 (patch)
treef8c0bb679dc8e72816e16820c3dbcccf924097eb /drivers/net/hp100.c
parent88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff)
[netdrvr] Fix register_netdev() races in older ISA net drivers
Diffstat (limited to 'drivers/net/hp100.c')
-rw-r--r--drivers/net/hp100.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index b3a898c5a585..c9d1a86d9594 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -417,12 +417,7 @@ struct net_device * __init hp100_probe(int unit)
417 if (err) 417 if (err)
418 goto out; 418 goto out;
419 419
420 err = register_netdev(dev);
421 if (err)
422 goto out1;
423 return dev; 420 return dev;
424 out1:
425 release_region(dev->base_addr, HP100_REGION_SIZE);
426 out: 421 out:
427 free_netdev(dev); 422 free_netdev(dev);
428 return ERR_PTR(err); 423 return ERR_PTR(err);
@@ -776,11 +771,22 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
776 printk("Warning! Link down.\n"); 771 printk("Warning! Link down.\n");
777 } 772 }
778 773
774 err = register_netdev(dev);
775 if (err)
776 goto out3;
777
779 return 0; 778 return 0;
779out3:
780 if (local_mode == 1)
781 pci_free_consistent(lp->pci_dev, MAX_RINGSIZE + 0x0f,
782 lp->page_vaddr_algn,
783 virt_to_whatever(dev, lp->page_vaddr_algn));
784 if (mem_ptr_virt)
785 iounmap(mem_ptr_virt);
780out2: 786out2:
781 release_region(ioaddr, HP100_REGION_SIZE); 787 release_region(ioaddr, HP100_REGION_SIZE);
782out1: 788out1:
783 return -ENODEV; 789 return err;
784} 790}
785 791
786/* This procedure puts the card into a stable init state */ 792/* This procedure puts the card into a stable init state */
@@ -2875,18 +2881,12 @@ static int __init hp100_eisa_probe (struct device *gendev)
2875 if (err) 2881 if (err)
2876 goto out1; 2882 goto out1;
2877 2883
2878 err = register_netdev(dev);
2879 if (err)
2880 goto out2;
2881
2882#ifdef HP100_DEBUG 2884#ifdef HP100_DEBUG
2883 printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name, 2885 printk("hp100: %s: EISA adapter found at 0x%x\n", dev->name,
2884 dev->base_addr); 2886 dev->base_addr);
2885#endif 2887#endif
2886 gendev->driver_data = dev; 2888 gendev->driver_data = dev;
2887 return 0; 2889 return 0;
2888 out2:
2889 release_region(dev->base_addr, HP100_REGION_SIZE);
2890 out1: 2890 out1:
2891 free_netdev(dev); 2891 free_netdev(dev);
2892 return err; 2892 return err;
@@ -2951,17 +2951,12 @@ static int __devinit hp100_pci_probe (struct pci_dev *pdev,
2951 err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev); 2951 err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev);
2952 if (err) 2952 if (err)
2953 goto out1; 2953 goto out1;
2954 err = register_netdev(dev);
2955 if (err)
2956 goto out2;
2957 2954
2958#ifdef HP100_DEBUG 2955#ifdef HP100_DEBUG
2959 printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr); 2956 printk("hp100: %s: PCI adapter found at 0x%x\n", dev->name, ioaddr);
2960#endif 2957#endif
2961 pci_set_drvdata(pdev, dev); 2958 pci_set_drvdata(pdev, dev);
2962 return 0; 2959 return 0;
2963 out2:
2964 release_region(dev->base_addr, HP100_REGION_SIZE);
2965 out1: 2960 out1:
2966 free_netdev(dev); 2961 free_netdev(dev);
2967 out0: 2962 out0:
@@ -3032,15 +3027,9 @@ static int __init hp100_isa_init(void)
3032 SET_MODULE_OWNER(dev); 3027 SET_MODULE_OWNER(dev);
3033 3028
3034 err = hp100_isa_probe(dev, hp100_port[i]); 3029 err = hp100_isa_probe(dev, hp100_port[i]);
3035 if (!err) { 3030 if (!err)
3036 err = register_netdev(dev); 3031 hp100_devlist[cards++] = dev;
3037 if (!err) 3032 else
3038 hp100_devlist[cards++] = dev;
3039 else
3040 release_region(dev->base_addr, HP100_REGION_SIZE);
3041 }
3042
3043 if (err)
3044 free_netdev(dev); 3033 free_netdev(dev);
3045 } 3034 }
3046 3035