public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: via sata oops on init
Date: Sat, 29 Jul 2006 12:41:15 -0400	[thread overview]
Message-ID: <20060729164115.GA16946@redhat.com> (raw)
In-Reply-To: <20060729144528.GD28712@leiferikson.dystopia.lan>

On Sat, Jul 29, 2006 at 04:45:28PM +0200, Johannes Weiner wrote:

 >  ..
 > ata_device_add fails, calls ata_host_remove with pointers to unitialized
 > memory.

This should do it.  Jeff?

Fix reference of uninitialised memory in ata_device_add()

Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6/drivers/scsi/libata-core.c~	2006-07-29 12:35:32.000000000 -0400
+++ linux-2.6/drivers/scsi/libata-core.c	2006-07-29 12:39:08.000000000 -0400
@@ -5419,10 +5419,10 @@ int ata_device_add(const struct ata_prob
 		unsigned long xfer_mode_mask;
 
 		ap = ata_host_add(ent, host_set, i);
+		host_set->ports[i] = ap;
 		if (!ap)
 			goto err_out;
 
-		host_set->ports[i] = ap;
 		xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |
 				(ap->mwdma_mask << ATA_SHIFT_MWDMA) |
 				(ap->pio_mask << ATA_SHIFT_PIO);
@@ -5532,6 +5532,8 @@ int ata_device_add(const struct ata_prob
 
 err_out:
 	for (i = 0; i < count; i++) {
+		if (!host_set->ports[i])
+			break;
 		ata_host_remove(host_set->ports[i], 1);
 		scsi_host_put(host_set->ports[i]->host);
 	}

-- 
http://www.codemonkey.org.uk

  reply	other threads:[~2006-07-29 16:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-28 23:39 via sata oops on init Dave Jones
2006-07-29 14:45 ` Johannes Weiner
2006-07-29 16:41   ` Dave Jones [this message]
2006-07-29 17:04     ` Johannes Weiner
2006-07-29 17:10       ` Dave Jones
2006-07-29 19:30         ` Johannes Weiner

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=20060729164115.GA16946@redhat.com \
    --to=davej@redhat.com \
    --cc=linux-kernel@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