From owner-svn-src-all@FreeBSD.ORG Fri Aug 2 14:44:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D6C65F80; Fri, 2 Aug 2013 14:44:11 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C31D92A61; Fri, 2 Aug 2013 14:44:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r72EiBVo059772; Fri, 2 Aug 2013 14:44:11 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r72EiBk2059771; Fri, 2 Aug 2013 14:44:11 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201308021444.r72EiBk2059771@svn.freebsd.org> From: Hiroki Sato Date: Fri, 2 Aug 2013 14:44:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253887 - head/sys/dev/filemon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 02 Aug 2013 14:44:11 -0000 Author: hrs Date: Fri Aug 2 14:44:11 2013 New Revision: 253887 URL: http://svnweb.freebsd.org/changeset/base/253887 Log: Add p_candebug() check to FILEMON_SET_PID ioctl. Discussed with: sjg MFC after: 3 days Modified: head/sys/dev/filemon/filemon.c Modified: head/sys/dev/filemon/filemon.c ============================================================================== --- head/sys/dev/filemon/filemon.c Fri Aug 2 14:14:23 2013 (r253886) +++ head/sys/dev/filemon/filemon.c Fri Aug 2 14:44:11 2013 (r253887) @@ -150,6 +150,7 @@ filemon_ioctl(struct cdev *dev, u_long c { int error = 0; struct filemon *filemon; + struct proc *p; devfs_get_cdevpriv((void **) &filemon); @@ -163,7 +164,13 @@ filemon_ioctl(struct cdev *dev, u_long c /* Set the monitored process ID. */ case FILEMON_SET_PID: - filemon->pid = *((pid_t *)data); + p = pfind(*((pid_t *)data)); + if (p == NULL) + return (EINVAL); + error = p_candebug(curthread, p); + if (error == 0) + filemon->pid = p->p_pid; + PROC_UNLOCK(p); break; default: