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.

ecryptfs: factor out a ecryptfs_iattr_to_lower helper

Prepare for using the code to create a lower struct iattr in multiple
places.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tyler Hicks <code@tyhicks.com>

authored by

Christoph Hellwig and committed by
Tyler Hicks
5d1f0e8c 081447ec

+15 -9
+15 -9
fs/ecryptfs/inode.c
··· 677 677 return buf; 678 678 } 679 679 680 + static void ecryptfs_iattr_to_lower(struct iattr *lower_ia, 681 + const struct iattr *ia) 682 + { 683 + memcpy(lower_ia, ia, sizeof(*lower_ia)); 684 + if (ia->ia_valid & ATTR_FILE) 685 + lower_ia->ia_file = ecryptfs_file_to_lower(ia->ia_file); 686 + /* 687 + * If the mode change is for clearing setuid/setgid bits, allow the lower 688 + * file system to interpret this in its own way. 689 + */ 690 + if (lower_ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) 691 + lower_ia->ia_valid &= ~ATTR_MODE; 692 + } 693 + 680 694 /** 681 695 * upper_size_to_lower_size 682 696 * @crypt_stat: Crypt_stat associated with file ··· 935 921 if (rc) 936 922 goto out; 937 923 938 - memcpy(&lower_ia, ia, sizeof(lower_ia)); 939 - if (ia->ia_valid & ATTR_FILE) 940 - lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file); 924 + ecryptfs_iattr_to_lower(&lower_ia, ia); 941 925 if (ia->ia_valid & ATTR_SIZE) { 942 926 rc = truncate_upper(dentry, ia, &lower_ia); 943 927 if (rc < 0) 944 928 goto out; 945 929 } 946 930 947 - /* 948 - * mode change is for clearing setuid/setgid bits. Allow lower fs 949 - * to interpret this in its own way. 950 - */ 951 - if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) 952 - lower_ia.ia_valid &= ~ATTR_MODE; 953 931 954 932 inode_lock(d_inode(lower_dentry)); 955 933 rc = notify_change(&nop_mnt_idmap, lower_dentry, &lower_ia, NULL);