diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-10-06 17:29:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-18 17:17:40 -0400 |
commit | 9fdbdd062bfc187e2aa32f7880fa7e8ae717efdf (patch) | |
tree | 473ad879cfb805c26f6f09a7ea5d02c49e15d411 | |
parent | 8193c4290620d9b2a6ac116719f11aa99053a90d (diff) |
parport_pc: release IO region properly if unsupported ITE887x card is found
sio_ite_8872_probe() bails out if it detects no-parallel (1S, 2S) or
unknown card.
It doesn't call release_region() on the previously allocated resource
though. This causes
(a) leak of the resource
(b) kernel oops when parport module is removed and /proc/ioports is read. This
is because the string that has been associated to the IO port region
is a static char array inside the already removed module.
Let's call release_region() properly before baling out.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Niels de Vos <ndevos@redhat.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Joe Krahn <krahn@niehs.nih.gov>
Signed-off-by: Andrew Morton <akpm@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/parport/parport_pc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index d1cdb9449f84..d0b597b50398 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -2595,14 +2595,17 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, | |||
2595 | break; | 2595 | break; |
2596 | case 0x6: | 2596 | case 0x6: |
2597 | printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n"); | 2597 | printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n"); |
2598 | release_region(inta_addr[i], 32); | ||
2598 | return 0; | 2599 | return 0; |
2599 | case 0x8: | 2600 | case 0x8: |
2600 | printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n"); | 2601 | printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n"); |
2602 | release_region(inta_addr[i], 32); | ||
2601 | return 0; | 2603 | return 0; |
2602 | default: | 2604 | default: |
2603 | printk(KERN_INFO "parport_pc: unknown ITE887x\n"); | 2605 | printk(KERN_INFO "parport_pc: unknown ITE887x\n"); |
2604 | printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' " | 2606 | printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' " |
2605 | "output to Rich.Liu@ite.com.tw\n"); | 2607 | "output to Rich.Liu@ite.com.tw\n"); |
2608 | release_region(inta_addr[i], 32); | ||
2606 | return 0; | 2609 | return 0; |
2607 | } | 2610 | } |
2608 | 2611 | ||