Skip to contentSkip to conversation

LIBATA: pata_ali.c misplaced pci_dev_put()

PATCH Applied Ben Dooks 3 participants 3 messages Jul 24, 2008 – Jul 31, 2008 libata

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

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.

drivers/ata/pata_ali.c +2 -1
Index: linux-2.6.26-quilt4/drivers/ata/pata_ali.c
===================================================================
@@ -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);
 }
 
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
Acked-by
#1 lore raw
Quoted 10 lines · On Thu, 24 Jul 2008 16:38:06 +0100 Ben Dooks <[email protected]> wrote:

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);
	}
Quoted 5 lines

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

Ooops...

Applied
#2 lore raw
In reply to Ben Dooks
Quoted 10 lines · Ben Dooks

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);
	}
Quoted 5 lines

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

applied