From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 22 22:50:01 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBEA81065671 for ; Wed, 22 Oct 2008 22:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9930D8FC20 for ; Wed, 22 Oct 2008 22:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MMo021068676 for ; Wed, 22 Oct 2008 22:50:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id m9MMo0kE068675; Wed, 22 Oct 2008 22:50:00 GMT (envelope-from gnats) Resent-Date: Wed, 22 Oct 2008 22:50:00 GMT Resent-Message-Id: <200810222250.m9MMo0kE068675@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Doug White Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FC8E106566C for ; Wed, 22 Oct 2008 22:47:58 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 7EDF08FC12 for ; Wed, 22 Oct 2008 22:47:58 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MMlwbi067346 for ; Wed, 22 Oct 2008 22:47:58 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id m9MMlwWX067345; Wed, 22 Oct 2008 22:47:58 GMT (envelope-from nobody) Message-Id: <200810222247.m9MMlwWX067345@www.freebsd.org> Date: Wed, 22 Oct 2008 22:47:58 GMT From: Doug White To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/128304: vn_pollrecord() derefs NULL if v_addpollinfo() fails X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 22:50:01 -0000 >Number: 128304 >Category: kern >Synopsis: vn_pollrecord() derefs NULL if v_addpollinfo() fails >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 22 22:50:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Doug White >Release: FreeBSD 7.0-RELEASE >Organization: Personal >Environment: FreeBSD mail1.sjc1.bitgravity.com 7.0-RELEASE-p4 FreeBSD 7.0-RELEASE-p4 #1: Mon Sep 29 18:30:06 PDT 2008 dwhite@mail1.sjc1.bitgravity.com:/usr/obj/usr/src/sys/BITGRAVITY amd64 >Description: The first few lines of vn_pollrecord() are: if (vp->v_pollinfo == NULL) v_addpollinfo(vp); mtx_lock(&vp->v_pollinfo->vpi_lock); v_addpollinfo() leaves vp->v_pollinfo NULL if the malloc attempt fails. vfs_kqfilter() checks for failure, but this function does not. If allocation were to fail then the mtx_lock() call would result in a null pointer dereference panic. >How-To-Repeat: Problem was found by code inspection. >Fix: vn_pollrecord() should ensure v_addpollinfo() succeeds in allocating the pollinfo lists. However vn_pollrecord() uses its return value to convey the original event mask so there does not appear to be a method to return an error value (ENOMEM, etc.) in the current implementation. >Release-Note: >Audit-Trail: >Unformatted: