Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Aug 2020 06:32:26 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363752 - in head/sys: kern sys
Message-ID:  <202008010632.0716WQVX041497@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Aug  1 06:32:25 2020
New Revision: 363752
URL: https://svnweb.freebsd.org/changeset/base/363752

Log:
  vfs: make rights mandatory for NDINIT_ALL

Modified:
  head/sys/kern/vfs_lookup.c
  head/sys/sys/namei.h

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Sat Aug  1 06:31:58 2020	(r363751)
+++ head/sys/kern/vfs_lookup.c	Sat Aug  1 06:32:25 2020	(r363752)
@@ -1371,6 +1371,7 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long fl
     struct thread *td)
 {
 
+	MPASS(rightsp != NULL);
 	ndp->ni_cnd.cn_nameiop = op;
 	ndp->ni_cnd.cn_flags = flags;
 	ndp->ni_segflg = segflg;
@@ -1380,10 +1381,7 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long fl
 	ndp->ni_resflags = 0;
 	filecaps_init(&ndp->ni_filecaps);
 	ndp->ni_cnd.cn_thread = td;
-	if (rightsp != NULL)
-		ndp->ni_rightsneeded = *rightsp;
-	else
-		cap_rights_init_zero(&ndp->ni_rightsneeded);
+	ndp->ni_rightsneeded = *rightsp;
 }
 
 /*

Modified: head/sys/sys/namei.h
==============================================================================
--- head/sys/sys/namei.h	Sat Aug  1 06:31:58 2020	(r363751)
+++ head/sys/sys/namei.h	Sat Aug  1 06:32:25 2020	(r363752)
@@ -188,13 +188,13 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_f
  * Initialization of a nameidata structure.
  */
 #define	NDINIT(ndp, op, flags, segflg, namep, td)			\
-	NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, 0, td)
+	NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, &cap_no_rights, td)
 #define	NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td)		\
-	NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, 0, td)
+	NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights, td)
 #define	NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp, td) \
 	NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp, td)
 #define	NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td)		\
-	NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, 0, td)
+	NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights, td)
 
 void NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags,
     enum uio_seg segflg, const char *namep, int dirfd, struct vnode *startdir,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008010632.0716WQVX041497>