via sata oops on init
2.6.18-rc2-git6
BUG: unable to handle kernel NULL pointer dereference at 00000000 EIP is at make_class_name+0x27 eax: 00000000 ebx: ffffffff ecx: ffffffff edx: 00000009 esi: f8d16cc2 edi: 00000000 ebp: f7fa9d3c esp: f7fa9d2c Call Trace: class_device_del+0xac
class_device_unregisterscsi_remove_hostata_host_removeata_device_addsvia_init_onepci_device_probedriver_probe_device__driver_attachbus_for_each_devdriver_attachbus_add_driverdriver_register__pci_register_driversvia_initsys_init_modulesyscall_call
Dave
Signature · 1 line
http://www.codemonkey.org.uk
Hi,
Quoted 9 lines · Dave Jones
2.6.18-rc2-git6
BUG: unable to handle kernel NULL pointer dereference at 00000000 EIP is at make_class_name+0x27 eax: 00000000 ebx: ffffffff ecx: ffffffff edx: 00000009 esi: f8d16cc2 edi: 00000000 ebp: f7fa9d3c esp: f7fa9d2c Call Trace: class_device_del+0xac
Quoted 4 lines
class_device_unregisterscsi_remove_hostata_host_removeata_device_add
I think the problem lays in scsi/libata-core.c:5423 in torvalds/linux-2.6 v2.6.18-rc2-g6482132, stating:
[...]
struct ata_host_set *host_set = kzalloc(...);
[...]
Initialization of some structure members, but not ports(!)
for (...) {
struct ata_port *ap;
ap = ata_host_add(ent, host_set, i);
if (!ap)
goto err_out;
host_set->ports[i] = ap;err_out:
for (i = 0; i < count; i++) {
ata_host_remove(host_set->ports[i], 1);[...]
ata_device_add fails, calls ata_host_remove with pointers to unitialized memory.
Hannes
Quoted 3 lines · Johannes Weiner
..
ata_device_addfails, callsata_host_removewith pointers to unitialized memory.
This should do it. Jeff?
Fix reference of uninitialised memory in ata_device_add()
drivers/scsi/libata-core.c renamed from drivers/scsi/libata-core.c~ +3 -1
@@ -5419,10 +5419,10 @@ int ata_device_add(const struct ata_probunsigned 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); }
Signature · 1 line
http://www.codemonkey.org.uk
Hi,
Quoted 15 lines · Dave Jones
drivers/scsi/libata-core.c renamed from drivers/scsi/libata-core.c~ +1
-1@@ -5419,10 +5419,10 @@ int ata_device_add(const struct ata_probunsigned 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 );
drivers/scsi/libata-core.c int ata_device_add(const struct ata_prob · line 5539
Quoted 8 lines
drivers/scsi/libata-core.c renamed from drivers/scsi/libata-core.c~ +2
-0@@ -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); }
You jump into loop just to skip it.
drivers/scsi/libata-core.c +1 -1
@@ -5420,7 +5420,7 @@ int ata_device_add(const struct ata_prob ap =ata_host_add (ent, host_set, i);if (!ap) - goto err_out; + goto err_free_ret; host_set->ports[i] = ap; xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |
Quoted 1 line · Johannes Weiner
You jump into loop just to skip it.
You have to. Look at the allocation again. It's in a loop. The first of which may have succeeded. Your patch will introduce a memory leak.
Dave
Quoted 13 lines
drivers/scsi/libata-core.c +1
-1@@ -5420,7 +5420,7 @@ int ata_device_add(const struct ata_prob ap =ata_host_add (ent, host_set, i);if (!ap) - goto err_out; + goto err_free_ret; host_set->ports[i] = ap; xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |
Signature · 1 line
http://www.codemonkey.org.uk
Hi,
Quoted 3 lines · Dave Jones
You have to. Look at the allocation again. It's in a loop. The first of which may have succeeded. Your patch will introduce a memory leak.
Holy crap! Yeah, I see it. Thanks :)
Hannes