From owner-svn-src-all@FreeBSD.ORG Thu May 23 21:07:27 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3768A82F; Thu, 23 May 2013 21:07:27 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2169113E; Thu, 23 May 2013 21:07:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r4NL7RQW081146; Thu, 23 May 2013 21:07:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r4NL7Q5x081145; Thu, 23 May 2013 21:07:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201305232107.r4NL7Q5x081145@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 May 2013 21:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250944 - head/sys/kern 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: Thu, 23 May 2013 21:07:27 -0000 Author: pjd Date: Thu May 23 21:07:26 2013 New Revision: 250944 URL: http://svnweb.freebsd.org/changeset/base/250944 Log: Use proper malloc type for ioctls white-list. Reported by: pho Tested by: pho Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Thu May 23 20:57:20 2013 (r250943) +++ head/sys/kern/sys_capability.c Thu May 23 21:07:26 2013 (r250944) @@ -144,6 +144,8 @@ sys_cap_getmode(struct thread *td, struc FEATURE(security_capabilities, "Capsicum Capabilities"); +MALLOC_DECLARE(M_FILECAPS); + static inline int _cap_check(cap_rights_t have, cap_rights_t need, enum ktr_cap_fail_type type) { @@ -229,7 +231,7 @@ sys_cap_rights_limit(struct thread *td, if (error == 0) { fdp->fd_ofiles[fd].fde_rights = rights; if ((rights & CAP_IOCTL) == 0) { - free(fdp->fd_ofiles[fd].fde_ioctls, M_TEMP); + free(fdp->fd_ofiles[fd].fde_ioctls, M_FILECAPS); fdp->fd_ofiles[fd].fde_ioctls = NULL; fdp->fd_ofiles[fd].fde_nioctls = 0; } @@ -344,10 +346,10 @@ sys_cap_ioctls_limit(struct thread *td, if (ncmds == 0) { cmds = NULL; } else { - cmds = malloc(sizeof(cmds[0]) * ncmds, M_TEMP, M_WAITOK); + cmds = malloc(sizeof(cmds[0]) * ncmds, M_FILECAPS, M_WAITOK); error = copyin(uap->cmds, cmds, sizeof(cmds[0]) * ncmds); if (error != 0) { - free(cmds, M_TEMP); + free(cmds, M_FILECAPS); return (error); } } @@ -372,7 +374,7 @@ sys_cap_ioctls_limit(struct thread *td, error = 0; out: FILEDESC_XUNLOCK(fdp); - free(cmds, M_TEMP); + free(cmds, M_FILECAPS); return (error); } @@ -548,7 +550,7 @@ sys_cap_new(struct thread *td, struct ca */ fdp->fd_ofiles[newfd].fde_rights = rights; if ((rights & CAP_IOCTL) == 0) { - free(fdp->fd_ofiles[newfd].fde_ioctls, M_TEMP); + free(fdp->fd_ofiles[newfd].fde_ioctls, M_FILECAPS); fdp->fd_ofiles[newfd].fde_ioctls = NULL; fdp->fd_ofiles[newfd].fde_nioctls = 0; }