From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 16:24:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D75E7106566B; Thu, 14 Jun 2012 16:24:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C2C8A8FC17; Thu, 14 Jun 2012 16:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EGO3SA005357; Thu, 14 Jun 2012 16:24:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EGO3Do005355; Thu, 14 Jun 2012 16:24:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141624.q5EGO3Do005355@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 16:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237081 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 16:24:03 -0000 Author: pjd Date: Thu Jun 14 16:24:03 2012 New Revision: 237081 URL: http://svn.freebsd.org/changeset/base/237081 Log: Explicitly assert that the filedesc lock is held when the fget_locked() function is called. MFC after: 1 month Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Thu Jun 14 16:23:16 2012 (r237080) +++ head/sys/sys/filedesc.h Thu Jun 14 16:24:03 2012 (r237081) @@ -142,7 +142,12 @@ static __inline struct file * fget_locked(struct filedesc *fdp, int fd) { - return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); + FILEDESC_LOCK_ASSERT(fdp); + + if (fd < 0 || fd >= fdp->fd_nfiles) + return (NULL); + + return (fdp->fd_ofiles[fd]); } #endif /* _KERNEL */