Commit d7a02fa0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull UBI/UBIFS updates from Richard Weinberger:

 - fscrypt framework usage updates

 - One huge fix for xattr unlink

 - Cleanup of fscrypt ifdefs

 - Fix for our new UBIFS auth feature

* tag 'upstream-5.2-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  ubi: wl: Fix uninitialized variable
  ubifs: Drop unnecessary setting of zbr->znode
  ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT
  ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
  ubifs: Limit number of xattrs per inode
  ubifs: orphan: Handle xattrs like files
  ubifs: journal: Handle xattrs like files
  ubifs: find.c: replace swap function with built-in one
  ubifs: Do not skip hash checking in data nodes
  ubifs: work around high stack usage with clang
  ubifs: remove unused function __ubifs_shash_final
  ubifs: remove unnecessary #ifdef around fscrypt_ioctl_get_policy()
  ubifs: remove unnecessary calls to set up directory key
parents 4dbf09fe 04d37e5a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1475,7 +1475,7 @@ static bool scrub_possible(struct ubi_device *ubi, struct ubi_wl_entry *e)
 */
int ubi_bitflip_check(struct ubi_device *ubi, int pnum, int force)
{
	int err;
	int err = 0;
	struct ubi_wl_entry *e;

	if (pnum < 0 || pnum >= ubi->peb_count) {
+9 −24
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash,
int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
			     struct shash_desc *inhash)
{
	SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
	struct ubifs_auth_node *auth = node;
	u8 *hash;
	int err;
@@ -85,12 +84,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
	if (!hash)
		return -ENOMEM;

	{
		SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);

		hash_desc->tfm = c->hash_tfm;
		ubifs_shash_copy_state(c, inhash, hash_desc);

		err = crypto_shash_final(hash_desc, hash);
		if (err)
			goto out;
	}

	err = ubifs_hash_calc_hmac(c, hash, auth->hmac);
	if (err)
@@ -142,24 +145,6 @@ struct shash_desc *__ubifs_hash_get_desc(const struct ubifs_info *c)
	return ubifs_get_desc(c, c->hash_tfm);
}

/**
 * __ubifs_shash_final - finalize shash
 * @c: UBIFS file-system description object
 * @desc: the descriptor
 * @out: the output hash
 *
 * Simple wrapper around crypto_shash_final(), safe to be called with
 * disabled authentication.
 */
int __ubifs_shash_final(const struct ubifs_info *c, struct shash_desc *desc,
			u8 *out)
{
	if (ubifs_authenticated(c))
		return crypto_shash_final(desc, out);

	return 0;
}

/**
 * ubifs_bad_hash - Report hash mismatches
 * @c: UBIFS file-system description object
+0 −1
Original line number Diff line number Diff line
@@ -1603,7 +1603,6 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
				err = PTR_ERR(child);
				goto out_unlock;
			}
			zbr->znode = child;
		}

		znode = child;
+14 −15
Original line number Diff line number Diff line
@@ -790,13 +790,11 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
		dentry, inode->i_ino,
		inode->i_nlink, dir->i_ino);

	if (ubifs_crypt_is_encrypted(dir)) {
		err = fscrypt_get_encryption_info(dir);
		if (err && err != -ENOKEY)
	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
	if (err)
		return err;
	}

	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
	err = ubifs_purge_xattrs(inode);
	if (err)
		return err;

@@ -900,13 +898,11 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
	if (err)
		return err;

	if (ubifs_crypt_is_encrypted(dir)) {
		err = fscrypt_get_encryption_info(dir);
		if (err && err != -ENOKEY)
	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
	if (err)
		return err;
	}

	err = fscrypt_setup_filename(dir, &dentry->d_name, 1, &nm);
	err = ubifs_purge_xattrs(inode);
	if (err)
		return err;

@@ -1292,9 +1288,14 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
		old_dentry, old_inode->i_ino, old_dir->i_ino,
		new_dentry, new_dir->i_ino, flags);

	if (unlink)
	if (unlink) {
		ubifs_assert(c, inode_is_locked(new_inode));

		err = ubifs_purge_xattrs(new_inode);
		if (err)
			return err;
	}

	if (unlink && is_dir) {
		err = ubifs_check_dir_empty(new_inode);
		if (err)
@@ -1650,9 +1651,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
	.listxattr   = ubifs_listxattr,
#endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
	.update_time = ubifs_update_time,
#endif
	.tmpfile     = ubifs_tmpfile,
};

+7 −9
Original line number Diff line number Diff line
@@ -1375,7 +1375,6 @@ static inline int mctime_update_needed(const struct inode *inode,
	return 0;
}

#ifdef CONFIG_UBIFS_ATIME_SUPPORT
/**
 * ubifs_update_time - update time of inode.
 * @inode: inode to update
@@ -1392,6 +1391,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
	int iflags = I_DIRTY_TIME;
	int err, release;

	if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
		return generic_update_time(inode, time, flags);

	err = ubifs_budget_space(c, &req);
	if (err)
		return err;
@@ -1414,7 +1416,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
		ubifs_release_budget(c, &req);
	return 0;
}
#endif

/**
 * update_mctime - update mtime and ctime of an inode.
@@ -1623,9 +1624,10 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
	if (err)
		return err;
	vma->vm_ops = &ubifs_file_vm_ops;
#ifdef CONFIG_UBIFS_ATIME_SUPPORT

	if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
		file_accessed(file);
#endif

	return 0;
}

@@ -1663,9 +1665,7 @@ const struct inode_operations ubifs_file_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
	.listxattr   = ubifs_listxattr,
#endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
	.update_time = ubifs_update_time,
#endif
};

const struct inode_operations ubifs_symlink_inode_operations = {
@@ -1675,9 +1675,7 @@ const struct inode_operations ubifs_symlink_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
	.listxattr   = ubifs_listxattr,
#endif
#ifdef CONFIG_UBIFS_ATIME_SUPPORT
	.update_time = ubifs_update_time,
#endif
};

const struct file_operations ubifs_file_operations = {
Loading