Date: Thu, 16 Nov 2006 21:32:32 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 110129 for review Message-ID: <200611162132.kAGLWWdB004298@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110129 Change 110129 by millert@millert_macbook on 2006/11/16 21:31:41 Add missing call to mac_vnode_check_truncate() for F_SETSIZE fcntl. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/kern_descrip.c#8 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/kern_descrip.c#8 (text+ko) ==== @@ -677,26 +677,35 @@ if (error) goto outdrop; + vp = (struct vnode *)fp->f_data; + error = vnode_getwithref(vp); + if (error) + goto outdrop; + +#ifdef MAC + error = mac_vnode_check_truncate(proc_ucred(p), + vfs_context_ucred(&context), vp); + if (error) { + (void)vnode_put(vp); + goto outdrop; + } +#endif /* * Make sure that we are root. Growing a file * without zero filling the data is a security hole * root would have access anyway so we'll allow it */ - if (!is_suser()) { error = EACCES; - goto outdrop; - } - vp = (struct vnode *)fp->f_data; - - if ( (error = vnode_getwithref(vp)) == 0 ) { - /* + } else { + /* * set the file size */ - error = vnode_setsize(vp, offset, IO_NOZEROFILL, &context); + error = vnode_setsize(vp, offset, IO_NOZEROFILL, + &context); + } - (void)vnode_put(vp); - } + (void)vnode_put(vp); goto outdrop; case F_RDAHEAD:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611162132.kAGLWWdB004298>