Bug 174277

Summary: [ata] [patch] ata_attach() panic's on disabled disk
Product: Base System Reporter: Peter Jeremy <peter>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 8.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

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
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:39:40 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>