Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+32 -58
+1 -1
fs/ubifs/Kconfig
··· 53 53 54 54 config UBIFS_FS_ENCRYPTION 55 55 bool "UBIFS Encryption" 56 - depends on UBIFS_FS 56 + depends on UBIFS_FS && BLOCK 57 57 select FS_ENCRYPTION 58 58 default n 59 59 help
+3 -55
fs/ubifs/dir.c
··· 390 390 dbg_gen("dent '%pd', mode %#hx in dir ino %lu", 391 391 dentry, mode, dir->i_ino); 392 392 393 - if (ubifs_crypt_is_encrypted(dir)) { 394 - err = fscrypt_get_encryption_info(dir); 395 - if (err) 396 - return err; 397 - 398 - if (!fscrypt_has_encryption_key(dir)) { 399 - return -EPERM; 400 - } 401 - } 402 - 403 393 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); 404 394 if (err) 405 395 return err; ··· 731 741 ubifs_assert(inode_is_locked(dir)); 732 742 ubifs_assert(inode_is_locked(inode)); 733 743 734 - if (ubifs_crypt_is_encrypted(dir)) { 735 - if (!fscrypt_has_permitted_context(dir, inode)) 736 - return -EPERM; 737 - 738 - err = fscrypt_get_encryption_info(inode); 739 - if (err) 740 - return err; 741 - 742 - if (!fscrypt_has_encryption_key(inode)) 743 - return -EPERM; 744 - } 744 + if (ubifs_crypt_is_encrypted(dir) && 745 + !fscrypt_has_permitted_context(dir, inode)) 746 + return -EPERM; 745 747 746 748 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); 747 749 if (err) ··· 982 1000 if (err) 983 1001 return err; 984 1002 985 - if (ubifs_crypt_is_encrypted(dir)) { 986 - err = fscrypt_get_encryption_info(dir); 987 - if (err) 988 - goto out_budg; 989 - 990 - if (!fscrypt_has_encryption_key(dir)) { 991 - err = -EPERM; 992 - goto out_budg; 993 - } 994 - } 995 - 996 1003 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); 997 1004 if (err) 998 1005 goto out_budg; ··· 1065 1094 if (err) { 1066 1095 kfree(dev); 1067 1096 return err; 1068 - } 1069 - 1070 - if (ubifs_crypt_is_encrypted(dir)) { 1071 - err = fscrypt_get_encryption_info(dir); 1072 - if (err) 1073 - goto out_budg; 1074 - 1075 - if (!fscrypt_has_encryption_key(dir)) { 1076 - err = -EPERM; 1077 - goto out_budg; 1078 - } 1079 1097 } 1080 1098 1081 1099 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); ··· 1188 1228 sd = kzalloc(disk_link.len, GFP_NOFS); 1189 1229 if (!sd) { 1190 1230 err = -ENOMEM; 1191 - goto out_inode; 1192 - } 1193 - 1194 - err = fscrypt_get_encryption_info(inode); 1195 - if (err) { 1196 - kfree(sd); 1197 - goto out_inode; 1198 - } 1199 - 1200 - if (!fscrypt_has_encryption_key(inode)) { 1201 - kfree(sd); 1202 - err = -EPERM; 1203 1231 goto out_inode; 1204 1232 } 1205 1233
+3
fs/ubifs/ioctl.c
··· 217 217 case FS_IOC32_SETFLAGS: 218 218 cmd = FS_IOC_SETFLAGS; 219 219 break; 220 + case FS_IOC_SET_ENCRYPTION_POLICY: 221 + case FS_IOC_GET_ENCRYPTION_POLICY: 222 + break; 220 223 default: 221 224 return -ENOIOCTLCMD; 222 225 }
+2
fs/ubifs/journal.c
··· 744 744 745 745 } else { 746 746 data->compr_size = 0; 747 + out_len = compr_len; 747 748 } 748 749 749 750 dlen = UBIFS_DATA_NODE_SZ + out_len; ··· 1320 1319 dn->compr_type = cpu_to_le16(compr_type); 1321 1320 dn->size = cpu_to_le32(*new_len); 1322 1321 *new_len = UBIFS_DATA_NODE_SZ + out_len; 1322 + err = 0; 1323 1323 out: 1324 1324 kfree(buf); 1325 1325 return err;
+23 -2
fs/ubifs/tnc.c
··· 34 34 #include <linux/slab.h> 35 35 #include "ubifs.h" 36 36 37 + static int try_read_node(const struct ubifs_info *c, void *buf, int type, 38 + int len, int lnum, int offs); 39 + static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, 40 + struct ubifs_zbranch *zbr, void *node); 41 + 37 42 /* 38 43 * Returned codes of 'matches_name()' and 'fallible_matches_name()' functions. 39 44 * @NAME_LESS: name corresponding to the first argument is less than second ··· 407 402 return 0; 408 403 } 409 404 410 - err = ubifs_tnc_read_node(c, zbr, node); 405 + if (c->replaying) { 406 + err = fallible_read_node(c, &zbr->key, zbr, node); 407 + /* 408 + * When the node was not found, return -ENOENT, 0 otherwise. 409 + * Negative return codes stay as-is. 410 + */ 411 + if (err == 0) 412 + err = -ENOENT; 413 + else if (err == 1) 414 + err = 0; 415 + } else { 416 + err = ubifs_tnc_read_node(c, zbr, node); 417 + } 411 418 if (err) 412 419 return err; 413 420 ··· 2874 2857 if (fname_len(nm) > 0) { 2875 2858 if (err) { 2876 2859 /* Handle collisions */ 2877 - err = resolve_collision(c, key, &znode, &n, nm); 2860 + if (c->replaying) 2861 + err = fallible_resolve_collision(c, key, &znode, &n, 2862 + nm, 0); 2863 + else 2864 + err = resolve_collision(c, key, &znode, &n, nm); 2878 2865 dbg_tnc("rc returned %d, znode %p, n %d", 2879 2866 err, znode, n); 2880 2867 if (unlikely(err < 0))