Commit 5ebaa2d1 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman
Browse files

staging: lustre: replace all CFS_CAP_* macros with CAP_*



Lustre defines a few CFS_CAP_* macros which are exactly the
same as the corresponding CAP_* macro, with one exception.

CFS_CAP_SYS_BOOT is 23
CAP_SYS_BOOT is 22.

CFS_CAP_SYS_BOOT is only used through CFS_CAP_FS_MASK and
causes capability 23 (CAP_SYS_NICE) to be dropped in certain
circumstances.
It is probable that the intention was to drop CAP_SYS_BOOT,
and this is what is now done.

CFS_CAP_CHOWN_MASK and CFS_CAP_SYS_RESOURCE_MASK are never
used, so they have been removed.

Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f23ccf86
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -56,25 +56,15 @@

typedef u32 cfs_cap_t;

#define CFS_CAP_CHOWN		   0
#define CFS_CAP_DAC_OVERRIDE	    1
#define CFS_CAP_DAC_READ_SEARCH	 2
#define CFS_CAP_FOWNER		  3
#define CFS_CAP_FSETID		  4
#define CFS_CAP_LINUX_IMMUTABLE	 9
#define CFS_CAP_SYS_ADMIN	      21
#define CFS_CAP_SYS_BOOT	       23
#define CFS_CAP_SYS_RESOURCE	   24

#define CFS_CAP_FS_MASK (BIT(CFS_CAP_CHOWN) |		\
			 BIT(CFS_CAP_DAC_OVERRIDE) |	\
			 BIT(CFS_CAP_DAC_READ_SEARCH) |	\
			 BIT(CFS_CAP_FOWNER) |		\
			 BIT(CFS_CAP_FSETID) |		\
			 BIT(CFS_CAP_LINUX_IMMUTABLE) | \
			 BIT(CFS_CAP_SYS_ADMIN) |	\
			 BIT(CFS_CAP_SYS_BOOT) |	\
			 BIT(CFS_CAP_SYS_RESOURCE))
#define CFS_CAP_FS_MASK (BIT(CAP_CHOWN) |		\
			 BIT(CAP_DAC_OVERRIDE) |	\
			 BIT(CAP_DAC_READ_SEARCH) |	\
			 BIT(CAP_FOWNER) |		\
			 BIT(CAP_FSETID) |		\
			 BIT(CAP_LINUX_IMMUTABLE) | \
			 BIT(CAP_SYS_ADMIN) |	\
			 BIT(CAP_SYS_BOOT) |	\
			 BIT(CAP_SYS_RESOURCE))

void cfs_cap_raise(cfs_cap_t cap);
void cfs_cap_lower(cfs_cap_t cap);
+0 −3
Original line number Diff line number Diff line
@@ -1058,9 +1058,6 @@ int sptlrpc_current_user_desc_size(void);
int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset);
int sptlrpc_unpack_user_desc(struct lustre_msg *req, int offset, int swabbed);

#define CFS_CAP_CHOWN_MASK (1 << CFS_CAP_CHOWN)
#define CFS_CAP_SYS_RESOURCE_MASK (1 << CFS_CAP_SYS_RESOURCE)

enum {
	LUSTRE_SEC_NONE	 = 0,
	LUSTRE_SEC_REMOTE       = 1,
+4 −4
Original line number Diff line number Diff line
@@ -885,7 +885,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
	switch (cmd) {
	case Q_SETQUOTA:
	case Q_SETINFO:
		if (!capable(CFS_CAP_SYS_ADMIN))
		if (!capable(CAP_SYS_ADMIN))
			return -EPERM;
		break;
	case Q_GETQUOTA:
@@ -893,7 +893,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
		      !uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
		     (type == GRPQUOTA &&
		      !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
		      !capable(CFS_CAP_SYS_ADMIN))
		      !capable(CAP_SYS_ADMIN))
			return -EPERM;
		break;
	case Q_GETINFO:
@@ -1452,7 +1452,7 @@ out_quotactl:
	}
	case OBD_IOC_CHANGELOG_SEND:
	case OBD_IOC_CHANGELOG_CLEAR:
		if (!capable(CFS_CAP_SYS_ADMIN))
		if (!capable(CAP_SYS_ADMIN))
			return -EPERM;

		rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
@@ -1556,7 +1556,7 @@ out_quotactl:
		return rc;
	}
	case LL_IOC_HSM_CT_START:
		if (!capable(CFS_CAP_SYS_ADMIN))
		if (!capable(CAP_SYS_ADMIN))
			return -EPERM;

		rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
+3 −3
Original line number Diff line number Diff line
@@ -1315,7 +1315,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
					    sizeof(struct lov_user_ost_data);
	int			 rc;

	if (!capable(CFS_CAP_SYS_ADMIN))
	if (!capable(CAP_SYS_ADMIN))
		return -EPERM;

	lump = libcfs_kvzalloc(lum_size, GFP_NOFS);
@@ -1570,7 +1570,7 @@ int ll_fid2path(struct inode *inode, void __user *arg)
	size_t outsize;
	int rc;

	if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
	if (!capable(CAP_DAC_READ_SEARCH) &&
	    !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
		return -EPERM;

@@ -1840,7 +1840,7 @@ int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss)
	 * NOT defined in HSM_USER_MASK.
	 */
	if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
	    !capable(CFS_CAP_SYS_ADMIN))
	    !capable(CAP_SYS_ADMIN))
		return -EPERM;

	/* Detect out-of range archive id */
+2 −2
Original line number Diff line number Diff line
@@ -1450,7 +1450,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
	/* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */
	if (attr->ia_valid & TIMES_SET_FLAGS) {
		if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
		    !capable(CFS_CAP_FOWNER))
		    !capable(CAP_FOWNER))
			return -EPERM;
	}

@@ -2597,7 +2597,7 @@ int ll_getparent(struct file *file, struct getparent __user *arg)
	u32 linkno;
	int rc;

	if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
	if (!capable(CAP_DAC_READ_SEARCH) &&
	    !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
		return -EPERM;

Loading