Page MenuHomeFreeBSD

D58081.1795808523.diff
No OneTemporary

Authored By
Unknown
Size
870 B
Referenced Files
None
Subscribers
None

D58081.1795808523.diff

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -3344,7 +3344,6 @@
error = ENOTDIR;
goto out_free;
}
- vrefact(vp);
/*
* XXX does not check for VDIR, handled by namei_setup
*/
@@ -3353,7 +3352,21 @@
if ((flags & UF_RESOLVE_BENEATH) != 0) {
cnp->cn_flags |= RBENEATH;
ndp->ni_resflags |= NIRES_BENEATH;
+ /*
+ * For empty path reopens, enforce that the new open
+ * does not gain additional access rights over the
+ * original file descriptor.
+ */
+ if ((cnp->cn_flags & EMPTYPATH) != 0 &&
+ (((cnp->cn_flags & OPENREAD) != 0 &&
+ (fp->f_flag & FREAD) == 0) ||
+ ((cnp->cn_flags & OPENWRITE) != 0 &&
+ (fp->f_flag & FWRITE) == 0))) {
+ error = EACCES;
+ goto out_free;
+ }
}
+ vrefact(vp);
fdrop(fp, td);
#ifdef CAPABILITIES

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 27, 7:42 PM (14 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42047771
Default Alt Text
D58081.1795808523.diff (870 B)

Event Timeline