Date: Wed, 22 Oct 2008 22:47:58 GMT From: Doug White <dwhite@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/128304: vn_pollrecord() derefs NULL if v_addpollinfo() fails Message-ID: <200810222247.m9MMlwWX067345@www.freebsd.org> Resent-Message-ID: <200810222250.m9MMo0kE068675@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810222247.m9MMlwWX067345>