Subject: kern/25787: malloc failure at raid setup time leads to a broken raid device
To: None <gnats-bugs@gnats.NetBSD.org>
From: Frank Kardel <kardel@pip.acrys.com>
List: netbsd-bugs
Date: 06/02/2004 16:18:16
>Number:         25787
>Category:       kern
>Synopsis:       malloc failure at raid setup time leads to a broken raid device
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 02 14:19:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Frank Kardel
>Release:        NetBSD 2.0F
>Organization:
	
>Environment:
System: NetBSD pip 2.0F NetBSD 2.0F (SYSPIP_ISDN) #4: Mon May 31 09:28:58 MEST 2004 kardel@pip:/fs/IC35L180AVV207-1-n/IC35L120AVV207-0-e/src/NetBSD/netbsd/sys/arch/i386/compile/obj.i386/SYSPIP_ISDN i386
Architecture: i386
Machine: i386
>Description:
	When configuring some 34-ish raids the configurarion fails with:
	raidXX: failed to allocate emergency buffer!.
	The device is configured nevertheless (see rf_driver.c). Processes accessing
	the device afterwards hang until interrupted. The device is unusable.
	There seem to be two issues here:
	  - missing error handling on allocation failures.
	  - there seems to be a (low) limit on how many raid devices the current kernel memory configuration
	    can support.
>How-To-Repeat:
	configure about 34 raid mirrors. watch configuration fail becaus malloc() return NULL.
	Accesses to the failed device hang.

>Fix:
	Fix error handling on allocation failures.
>Release-Note:
>Audit-Trail:
>Unformatted: