Bug 24628

Summary: if netgraph seriously runs out of queue entries it crashes the kernel
Product: Base System Reporter: brandt <brandt>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description brandt 2001-01-25 08:50:01 UTC
The function ng_getqblk() in ng_base.c allocates queue entries. If it
fails to allocate one, it drops out of a loop in that function and,
just before returning to the caller, tries to clear the NCGF_FREE flag
on the entry it is about to return. If the allocation has failed, this
will access a NULL pointer.

Fix: 

Replace:
item->el_flags &= ~NGQF_FREE;

By:
        if(item)
                item->el_flags &= ~NGQF_FREE;
at the end of ng_getqblk().
How-To-Repeat: Use up all available kernel memory and try to send netgraph messages.
Comment 1 Alfred Perlstein freebsd_committer freebsd_triage 2001-07-13 09:36:57 UTC
State Changed
From-To: open->closed

Fixed in revision 1.54 of src/sys/netgraph/ng_base.c