+ drivers-isdn-ioremap-balanced-with-iounmap.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     drivers/isdn: ioremap balanced with iounmap

has been added to the -mm tree.  Its filename is

     drivers-isdn-ioremap-balanced-with-iounmap.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: drivers/isdn: ioremap balanced with iounmap
From: Amol Lad <amol@xxxxxxxxxxxxxxxxxxx>

ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Signed-off-by: Amol Lad <amol@xxxxxxxxxxxxxxxxxxx>
Cc: Karsten Keil <kkeil@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/isdn/hisax/diva.c      |   26 ++++++++++++++++++++++++--
 drivers/isdn/hysdn/boardergo.c |    2 +-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff -puN drivers/isdn/hisax/diva.c~drivers-isdn-ioremap-balanced-with-iounmap drivers/isdn/hisax/diva.c
--- a/drivers/isdn/hisax/diva.c~drivers-isdn-ioremap-balanced-with-iounmap
+++ a/drivers/isdn/hisax/diva.c
@@ -716,8 +716,10 @@ release_io_diva(struct IsdnCardState *cs
 
 		*cfg = 0; /* disable INT0/1 */ 
 		*cfg = 2; /* reset pending INT0 */
-		iounmap((void *)cs->hw.diva.cfg_reg);
-		iounmap((void *)cs->hw.diva.pci_cfg);
+		if (cs->hw.diva.cfg_reg)
+			iounmap((void *)cs->hw.diva.cfg_reg);
+		if (cs->hw.diva.pci_cfg)
+			iounmap((void *)cs->hw.diva.pci_cfg);
 		return;
 	} else if (cs->subtyp != DIVA_IPAC_ISA) {
 		del_timer(&cs->hw.diva.tl);
@@ -734,6 +736,23 @@ release_io_diva(struct IsdnCardState *cs
 }
 
 static void
+iounmap_diva(struct IsdnCardState *cs)
+{
+	if ((cs->subtyp == DIVA_IPAC_PCI) || (cs->subtyp == DIVA_IPACX_PCI)) {
+		if (cs->hw.diva.cfg_reg) {
+			iounmap((void *)cs->hw.diva.cfg_reg);
+			cs->hw.diva.cfg_reg = 0;
+		}
+		if (cs->hw.diva.pci_cfg) {
+			iounmap((void *)cs->hw.diva.pci_cfg);
+			cs->hw.diva.pci_cfg = 0;
+		}
+	}
+
+	return;
+}
+
+static void
 reset_diva(struct IsdnCardState *cs)
 {
 	if (cs->subtyp == DIVA_IPAC_ISA) {
@@ -1069,11 +1088,13 @@ setup_diva(struct IsdnCard *card)
 
 		if (!cs->irq) {
 			printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
+			iounmap_diva(cs);
 			return(0);
 		}
 
 		if (!cs->hw.diva.cfg_reg) {
 			printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
+			iounmap_diva(cs);
 			return(0);
 		}
 		cs->irq_flags |= IRQF_SHARED;
@@ -1123,6 +1144,7 @@ ready:
 			       CardType[card->typ],
 			       cs->hw.diva.cfg_reg,
 			       cs->hw.diva.cfg_reg + bytecnt);
+			iounmap_diva(cs);
 			return (0);
 		}
 	}
diff -puN drivers/isdn/hysdn/boardergo.c~drivers-isdn-ioremap-balanced-with-iounmap drivers/isdn/hysdn/boardergo.c
--- a/drivers/isdn/hysdn/boardergo.c~drivers-isdn-ioremap-balanced-with-iounmap
+++ a/drivers/isdn/hysdn/boardergo.c
@@ -403,7 +403,7 @@ ergo_releasehardware(hysdn_card * card)
 	free_irq(card->irq, card);	/* release interrupt */
 	release_region(card->iobase + PCI9050_INTR_REG, 1);	/* release all io ports */
 	release_region(card->iobase + PCI9050_USER_IO, 1);
-	vfree(card->dpram);
+	iounmap(card->dpram);
 	card->dpram = NULL;	/* release shared mem */
 }				/* ergo_releasehardware */
 
_

Patches currently in -mm which might be from amol@xxxxxxxxxxxxxxxxxxx are

origin.patch
ioremap-balanced-with-iounmap-for-drivers-pcmcia.patch
ioremap-balanced-with-iounmap-drivers-scsi-zalonc.patch
ioremap-balanced-with-iounmap-drivers-scsi-sun3_scsic.patch
ioremap-balanced-with-iounmap-drivers-scsi-sun3_scsi_vmec.patch
ioremap-balanced-with-iounmap-drivers-scsi-seagatec.patch
ioremap-balanced-with-iounmap-drivers-scsi-qlogicptic.patch
ioremap-balanced-with-iounmap-drivers-scsi-nsp32c.patch
ioremap-balanced-with-iounmap-drivers-scsi-ncr53c8xxc.patch
ioremap-balanced-with-iounmap-drivers-scsi-fdomainc.patch
ioremap-balanced-with-iounmap-drivers-scsi-amiga7xxc.patch
ioremap-balanced-with-iounmap-drivers-scsi-3w-9xxxc.patch
drivers-scsi-ncr5380c-replacing-yield-with-a.patch
drivers-scsi-megaraidc-replacing-yield-with-a.patch
git-watchdog.patch
ioremap-balanced-with-iounmap-for-drivers-char-rio-rio_linuxc.patch
ioremap-balanced-with-iounmap-for-drivers-char-moxac.patch
ioremap-balanced-with-iounmap-for-drivers-char-istallionc.patch
sound-oss-btaudioc-ioremap-balanced-with-iounmap.patch
drivers-isdn-hysdn-save_flags-cli-restore_flags-replaced-appropriately.patch
drivers-isdn-isdnloop-save_flags-cli-restore_flags-replaced-appropriately.patch
drivers-isdn-ioremap-balanced-with-iounmap.patch
ioremap-balanced-with-iounmap-for-drivers-video-virgefb.patch
ioremap-balanced-with-iounmap-for-drivers-video-vesafb.patch
ioremap-balanced-with-iounmap-for-drivers-video-tridentfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-tgafb.patch
ioremap-balanced-with-iounmap-for-drivers-video-stifb.patch
ioremap-balanced-with-iounmap-for-drivers-video-retz3fb.patch
ioremap-balanced-with-iounmap-for-drivers-video-pvr2fb.patch
ioremap-balanced-with-iounmap-for-drivers-video-platinumfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-offb.patch
ioremap-balanced-with-iounmap-for-drivers-video-macfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-hpfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-fm2fb.patch
ioremap-balanced-with-iounmap-for-drivers-video-ffb.patch
ioremap-balanced-with-iounmap-for-drivers-video-cyberfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-cirrusfb.patch
ioremap-balanced-with-iounmap-for-drivers-video-atyfb_base.patch
ioremap-balanced-with-iounmap-for-drivers-video-atafb.patch
ioremap-balanced-with-iounmap-for-drivers-video-amifb.patch
ioremap-balanced-with-iounmap-for-drivers-video-S3triofb.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux