Bug 174277 - [ata] [patch] ata_attach() panic's on disabled disk
Summary: [ata] [patch] ata_attach() panic's on disabled disk
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2012-12-08 11:00 UTC by Peter Jeremy
Modified: 2018-01-03 05:13 UTC (History)
0 users

See Also:

file.diff (845 bytes, patch)
2012-12-08 11:00 UTC, Peter Jeremy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Jeremy 2012-12-08 11:00:00 UTC
	After updating my netbook from 8.x r237444 to 8.x r242865, I
	found it panics "page fault while in kernel mode" in
	ata_identify().  Working back, ata_boot_attach() is passing
	NULL to ata_identify() and the device_get_softc() at the top
	of ata_identify() is dereferencing that and setting "ch" to
	garbage which panics on ch->devices.

	Working back further, I have "hint.ata.0.disabled=1" in my
	loader.conf (because the boot device is on ata1 and there's
	nothing attached to ata0 so disabling it sped up the boot).
	It appears that this leaves ata0 with a present but zero'd
	softc - which isn't correctly handled in ata_boot_attach().

	It's not clear to me what changed between r237444 and r242865
	to cause this problem to become apparent.  The relevant ata(4)
	code has not been touched for some time.

Fix: Whilst I have only tested it on 8.x, this patch appears to
	be applicable to 9.x and head as well.
How-To-Repeat: 	On a system with an ATA controllor and ata(4) in the kernel,
	boot with ata0 disabled as per the above.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:36 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped