linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: linux-ide@vger.kernel.org
Cc: Ben Dooks <ben-linux@fluff.org>
Subject: LIBATA: pata_ali.c misplaced pci_dev_put()
Date: Thu, 24 Jul 2008 16:38:06 +0100	[thread overview]
Message-ID: <20080724153806.633927699@fluff.org.uk> (raw)

[-- Attachment #1: simtec/simtec-libata-stop-pci-get-leak.patch --]
[-- Type: text/plain, Size: 1098 bytes --]

The ali_init_one() function does a search for an isa_bridge,
but then fails to release it if the revision information was
not correctly found.

the problem comes from:
	isa_bridge = pci_get_device(...);
	if (isa_bridge && ...) {
		pci_dev_put(isa_bridge);
	}

where the pci_dev_put() is never called if isa_bridge
was valid but the extra checks on the chip-revision
fail to match.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.26-quilt4/drivers/ata/pata_ali.c
===================================================================
--- linux-2.6.26-quilt4.orig/drivers/ata/pata_ali.c	2008-07-24 16:26:43.000000000 +0100
+++ linux-2.6.26-quilt4/drivers/ata/pata_ali.c	2008-07-24 16:27:24.000000000 +0100
@@ -550,8 +550,9 @@ static int ali_init_one(struct pci_dev *
 		pci_read_config_byte(isa_bridge, 0x5E, &tmp);
 		if ((tmp & 0x1E) == 0x12)
 	        	ppi[0] = &info_20_udma;
-		pci_dev_put(isa_bridge);
 	}
+	pci_dev_put(isa_bridge);
+
 	return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL);
 }
 

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

             reply	other threads:[~2008-07-24 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 15:38 Ben Dooks [this message]
2008-07-24 15:34 ` LIBATA: pata_ali.c misplaced pci_dev_put() Alan Cox
2008-07-31  5:40 ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080724153806.633927699@fluff.org.uk \
    --to=ben-linux@fluff.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).