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; } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"