kern/128304: vn_pollrecord() derefs NULL if v_addpollinfo() fails

Mateusz Guzik mjguzik at gmail.com
Thu Oct 23 12:00:08 UTC 2008


The following reply was made to PR kern/128304; it has been noted by GNATS.

From: Mateusz Guzik <mjguzik at gmail.com>
To: bug-followup at freebsd.org
Cc:  
Subject: Re: kern/128304: vn_pollrecord() derefs NULL if v_addpollinfo() fails
Date: Thu, 23 Oct 2008 13:57:43 +0200

 Hi.
 
 failure of uma_zalloc() would cause null pointer dereference in
 v_addpollinfo() anyway (due to mtx_init() call).
 
 From commit message for rev 1.142 of sys/vm/uma_core.c:
 
 Remove uma_zalloc_arg() hack, which coerced M_WAITOK to M_NOWAIT when
 allocations were made using improper flags in interrupt context.
 Replace with a simple WITNESS warning call.  This restores the
 invariant that M_WAITOK allocations will always succeed or die
 horribly trying, which is relied on by many UMA consumers.
 
 So it's ok to rely on M_WAITOK (which v_addpollinfo() does) and additional
 null check in vfs_kqfilter() can be removed as being meaningles.
 
 Thanks,
 --
 Mateusz Guzik


More information about the freebsd-bugs mailing list