mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
This pull request contains fixes for UBIFS:
- A long standing issue in UBIFS journal replay code - Fallout from the merge window -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJYf+HTAAoJEEtJtSqsAOnWD8YQAKZB6zkj8MMhuy5Pbf9Me9fS fhLhKXEtF6sAsqwkCzCFdplnszesnljuP44eNvD9bDBXqFrcj0MErNQFRqN9EhKE pfixectW7smexm7HMuUSa1K3LDNel41e8wdnFc5bAS4o6sjo/pp8sotGZ/wC/J+u hQeuMRlfXMgHkc58AP2QRVhoBa+l8uKRYfrql10Am5FDWwKhHKDeLXFhwW/xNjU0 dUUDQ4v1zNxM71cD8lILoXOecmN0o+u+IK9CokzJycHM4Ncw34NAdDp5sFFAqsFj hnlmSGRx60+CDjCWaVCzOcc9r/S4toXDuksBzhN4qvCEhx0njy0jtoIabTkMhXC3 t9tCSbsg+GETsKXr+SHYWjvFZf3oEYJEdu2dCaH7clyWT5T9roGH4tmOiJNXcXt7 CxY8PP220m4OkON0bHZyLkGXCsD4zdgKDCyitStYxfyj3fhcCQxa0QkqJi3+RyN2 xmQj8IieYqpODg7BaB3xP94NiPFpiiUFXGL4wJIJLQoA09jd/VQQN/1Ugcu81H1u 2Kw7sA13nv7YhnA9L/EBFrY8kMdzkIy/zqD8lBOHeQfVpOaXAzGx99a0boU3q5y2 oaLRiJtGJ2QRu7f3uXxnwG7QBnzLI29or5j4Cy88NqHX0UBoIRHe5HH0fZBATNjF cGDN5c7qRwT91WO2ilsD =GrH8 -----END PGP SIGNATURE----- Merge tag 'upstream-4.10-rc5' of git://git.infradead.org/linux-ubifs Pull UBIFS fixes from Richard Weinberger: "This contains fixes for UBIFS: - a long standing issue in UBIFS journal replay code - fallout from the merge window" * tag 'upstream-4.10-rc5' of git://git.infradead.org/linux-ubifs: ubifs: Fix journal replay wrt. xattr nodes ubifs: remove redundant checks for encryption key ubifs: allow encryption ioctls in compat mode ubifs: add CONFIG_BLOCK dependency for encryption ubifs: fix unencrypted journal write ubifs: ensure zero err is returned on successful return
This commit is contained in:
commit
fb1d8e0e2c
5 changed files with 32 additions and 58 deletions
|
@ -53,7 +53,7 @@ config UBIFS_ATIME_SUPPORT
|
|||
|
||||
config UBIFS_FS_ENCRYPTION
|
||||
bool "UBIFS Encryption"
|
||||
depends on UBIFS_FS
|
||||
depends on UBIFS_FS && BLOCK
|
||||
select FS_ENCRYPTION
|
||||
default n
|
||||
help
|
||||
|
|
|
@ -390,16 +390,6 @@ static int do_tmpfile(struct inode *dir, struct dentry *dentry,
|
|||
dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
|
||||
dentry, mode, dir->i_ino);
|
||||
|
||||
if (ubifs_crypt_is_encrypted(dir)) {
|
||||
err = fscrypt_get_encryption_info(dir);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!fscrypt_has_encryption_key(dir)) {
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
|
||||
err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -741,17 +731,9 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
|
|||
ubifs_assert(inode_is_locked(dir));
|
||||
ubifs_assert(inode_is_locked(inode));
|
||||
|
||||
if (ubifs_crypt_is_encrypted(dir)) {
|
||||
if (!fscrypt_has_permitted_context(dir, inode))
|
||||
return -EPERM;
|
||||
|
||||
err = fscrypt_get_encryption_info(inode);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!fscrypt_has_encryption_key(inode))
|
||||
return -EPERM;
|
||||
}
|
||||
if (ubifs_crypt_is_encrypted(dir) &&
|
||||
!fscrypt_has_permitted_context(dir, inode))
|
||||
return -EPERM;
|
||||
|
||||
err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
|
||||
if (err)
|
||||
|
@ -1000,17 +982,6 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (ubifs_crypt_is_encrypted(dir)) {
|
||||
err = fscrypt_get_encryption_info(dir);
|
||||
if (err)
|
||||
goto out_budg;
|
||||
|
||||
if (!fscrypt_has_encryption_key(dir)) {
|
||||
err = -EPERM;
|
||||
goto out_budg;
|
||||
}
|
||||
}
|
||||
|
||||
err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
|
||||
if (err)
|
||||
goto out_budg;
|
||||
|
@ -1096,17 +1067,6 @@ static int ubifs_mknod(struct inode *dir, struct dentry *dentry,
|
|||
return err;
|
||||
}
|
||||
|
||||
if (ubifs_crypt_is_encrypted(dir)) {
|
||||
err = fscrypt_get_encryption_info(dir);
|
||||
if (err)
|
||||
goto out_budg;
|
||||
|
||||
if (!fscrypt_has_encryption_key(dir)) {
|
||||
err = -EPERM;
|
||||
goto out_budg;
|
||||
}
|
||||
}
|
||||
|
||||
err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
|
||||
if (err)
|
||||
goto out_budg;
|
||||
|
@ -1231,18 +1191,6 @@ static int ubifs_symlink(struct inode *dir, struct dentry *dentry,
|
|||
goto out_inode;
|
||||
}
|
||||
|
||||
err = fscrypt_get_encryption_info(inode);
|
||||
if (err) {
|
||||
kfree(sd);
|
||||
goto out_inode;
|
||||
}
|
||||
|
||||
if (!fscrypt_has_encryption_key(inode)) {
|
||||
kfree(sd);
|
||||
err = -EPERM;
|
||||
goto out_inode;
|
||||
}
|
||||
|
||||
ostr.name = sd->encrypted_path;
|
||||
ostr.len = disk_link.len;
|
||||
|
||||
|
|
|
@ -217,6 +217,9 @@ long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|||
case FS_IOC32_SETFLAGS:
|
||||
cmd = FS_IOC_SETFLAGS;
|
||||
break;
|
||||
case FS_IOC_SET_ENCRYPTION_POLICY:
|
||||
case FS_IOC_GET_ENCRYPTION_POLICY:
|
||||
break;
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
|
|
@ -744,6 +744,7 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
|
|||
|
||||
} else {
|
||||
data->compr_size = 0;
|
||||
out_len = compr_len;
|
||||
}
|
||||
|
||||
dlen = UBIFS_DATA_NODE_SZ + out_len;
|
||||
|
@ -1319,6 +1320,7 @@ static int truncate_data_node(const struct ubifs_info *c, const struct inode *in
|
|||
dn->compr_type = cpu_to_le16(compr_type);
|
||||
dn->size = cpu_to_le32(*new_len);
|
||||
*new_len = UBIFS_DATA_NODE_SZ + out_len;
|
||||
err = 0;
|
||||
out:
|
||||
kfree(buf);
|
||||
return err;
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
#include <linux/slab.h>
|
||||
#include "ubifs.h"
|
||||
|
||||
static int try_read_node(const struct ubifs_info *c, void *buf, int type,
|
||||
int len, int lnum, int offs);
|
||||
static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
|
||||
struct ubifs_zbranch *zbr, void *node);
|
||||
|
||||
/*
|
||||
* Returned codes of 'matches_name()' and 'fallible_matches_name()' functions.
|
||||
* @NAME_LESS: name corresponding to the first argument is less than second
|
||||
|
@ -402,7 +407,19 @@ static int tnc_read_hashed_node(struct ubifs_info *c, struct ubifs_zbranch *zbr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
err = ubifs_tnc_read_node(c, zbr, node);
|
||||
if (c->replaying) {
|
||||
err = fallible_read_node(c, &zbr->key, zbr, node);
|
||||
/*
|
||||
* When the node was not found, return -ENOENT, 0 otherwise.
|
||||
* Negative return codes stay as-is.
|
||||
*/
|
||||
if (err == 0)
|
||||
err = -ENOENT;
|
||||
else if (err == 1)
|
||||
err = 0;
|
||||
} else {
|
||||
err = ubifs_tnc_read_node(c, zbr, node);
|
||||
}
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -2857,7 +2874,11 @@ struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c,
|
|||
if (fname_len(nm) > 0) {
|
||||
if (err) {
|
||||
/* Handle collisions */
|
||||
err = resolve_collision(c, key, &znode, &n, nm);
|
||||
if (c->replaying)
|
||||
err = fallible_resolve_collision(c, key, &znode, &n,
|
||||
nm, 0);
|
||||
else
|
||||
err = resolve_collision(c, key, &znode, &n, nm);
|
||||
dbg_tnc("rc returned %d, znode %p, n %d",
|
||||
err, znode, n);
|
||||
if (unlikely(err < 0))
|
||||
|
|
Loading…
Reference in a new issue