lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1110061654280.31654@pobox.suse.cz>
Date:	Thu, 6 Oct 2011 17:38:55 +0200 (CEST)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Bjorn Helgaas <bjorn.helgaas@...com>,
	Niels de Vos <ndevos@...hat.com>,
	Alan Cox <alan@...ux.intel.com>,
	Greg Kroah-Hartman <gregkh@...e.de>
Cc:	Joe Krahn <krahn@...hs.nih.gov>, Andrew Morton <akpm@...gle.com>,
	Rich.Liu@....com.tw, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...e.cz>
---
 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 d1cdb94..d0b597b 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,
 		break;
 	case 0x6:
 		printk(KERN_INFO "parport_pc: ITE8873 found (1S)\n");
+		release_region(inta_addr[i], 32);
 		return 0;
 	case 0x8:
 		printk(KERN_INFO "parport_pc: ITE8874 found (2S)\n");
+		release_region(inta_addr[i], 32);
 		return 0;
 	default:
 		printk(KERN_INFO "parport_pc: unknown ITE887x\n");
 		printk(KERN_INFO "parport_pc: please mail 'lspci -nvv' "
 			"output to Rich.Liu@....com.tw\n");
+		release_region(inta_addr[i], 32);
 		return 0;
 	}
 
-- 
1.7.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ