Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0e45ea7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "FROMLIST : 9p: fix a potential acl leak"

parents d17c0ceb 68634568
Loading
Loading
Loading
Loading
+20 −23
Original line number Diff line number Diff line
@@ -320,25 +320,23 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
	case ACL_TYPE_ACCESS:
		name = POSIX_ACL_XATTR_ACCESS;
		if (acl) {
			umode_t mode = inode->i_mode;
			retval = posix_acl_equiv_mode(acl, &mode);
			if (retval < 0)
				goto err_out;
			else {
			struct iattr iattr;
				if (retval == 0) {
			struct posix_acl *old_acl = acl;

			retval = posix_acl_update_mode(inode,
				&iattr.ia_mode, &acl);
			if (retval)
				goto err_out;
			if (!acl) {
				/*
				 * ACL can be represented
				 * by the mode bits. So don't
				 * update ACL.
				 */
					acl = NULL;
				posix_acl_release(old_acl);
				value = NULL;
				size = 0;
			}
				/* Updte the mode bits */
				iattr.ia_mode = ((mode & S_IALLUGO) |
						 (inode->i_mode & ~S_IALLUGO));
			iattr.ia_valid = ATTR_MODE;
			/* FIXME should we update ctime ?
			 * What is the following setxattr update the
@@ -346,7 +344,6 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
			 */
			v9fs_vfs_setattr_dotl(dentry, &iattr);
		}
		}
		break;
	case ACL_TYPE_DEFAULT:
		name = POSIX_ACL_XATTR_DEFAULT;
+3 −4
Original line number Diff line number Diff line
@@ -118,11 +118,10 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans,
	case ACL_TYPE_ACCESS:
		name = POSIX_ACL_XATTR_ACCESS;
		if (acl) {
			ret = posix_acl_equiv_mode(acl, &inode->i_mode);
			if (ret < 0)
			ret = posix_acl_update_mode(inode,
				&inode->i_mode, &acl);
			if (ret)
				return ret;
			if (ret == 0)
				acl = NULL;
		}
		ret = 0;
		break;
+5 −8
Original line number Diff line number Diff line
@@ -206,15 +206,12 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
		case ACL_TYPE_ACCESS:
			name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
			if (acl) {
				error = posix_acl_equiv_mode(acl, &inode->i_mode);
				if (error < 0)
				error = posix_acl_update_mode(inode,
					&inode->i_mode, &acl);
				if (error)
					return error;
				else {
				inode->i_ctime = CURRENT_TIME_SEC;
				mark_inode_dirty(inode);
					if (error == 0)
						acl = NULL;
				}
			}
			break;

+5 −8
Original line number Diff line number Diff line
@@ -211,15 +211,12 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
	case ACL_TYPE_ACCESS:
		name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
		if (acl) {
			error = posix_acl_equiv_mode(acl, &inode->i_mode);
			if (error < 0)
			error = posix_acl_update_mode(inode,
				&inode->i_mode, &acl);
			if (error)
				return error;
			else {
			inode->i_ctime = ext4_current_time(inode);
			ext4_mark_inode_dirty(handle, inode);
				if (error == 0)
					acl = NULL;
			}
		}
		break;

+3 −4
Original line number Diff line number Diff line
@@ -223,12 +223,11 @@ static int f2fs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
	case ACL_TYPE_ACCESS:
		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
		if (acl) {
			error = posix_acl_equiv_mode(acl, &inode->i_mode);
			if (error < 0)
			error = posix_acl_update_mode(inode,
				&inode->i_mode, &acl);
			if (error)
				return error;
			set_acl_inode(fi, inode->i_mode);
			if (error == 0)
				acl = NULL;
		}
		break;

Loading