Re: [PATCH] f2fs: don't allow rename unencrypted file to encrypted directory

From: kbuild test robot
Date: Fri Mar 10 2017 - 16:50:09 EST


Hi Chao,

[auto build test WARNING on f2fs/dev]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Chao-Yu/f2fs-don-t-allow-rename-unencrypted-file-to-encrypted-directory/20170311-052705
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev
config: i386-randconfig-x005-201710 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

fs/f2fs/namei.c: In function 'f2fs_cross_rename':
>> fs/f2fs/namei.c:858:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +858 fs/f2fs/namei.c

842 struct f2fs_sb_info *sbi = F2FS_I_SB(old_dir);
843 struct inode *old_inode = d_inode(old_dentry);
844 struct inode *new_inode = d_inode(new_dentry);
845 struct page *old_dir_page, *new_dir_page;
846 struct page *old_page, *new_page;
847 struct f2fs_dir_entry *old_dir_entry = NULL, *new_dir_entry = NULL;
848 struct f2fs_dir_entry *old_entry, *new_entry;
849 int old_nlink = 0, new_nlink = 0;
850 int err = -ENOENT;
851
852 if ((f2fs_encrypted_inode(old_dir) &&
853 !fscrypt_has_encryption_key(old_dir)) ||
854 (f2fs_encrypted_inode(new_dir) &&
855 !fscrypt_has_encryption_key(new_dir)))
856 return -ENOKEY;
857
> 858 if (f2fs_encrypted_inode(old_dir) && !f2fs_encrypted_inode(new_inode) ||
859 f2fs_encrypted_inode(new_dir) && !f2fs_encrypted_inode(old_inode))
860 return -EPERM;
861
862 if ((f2fs_encrypted_inode(old_dir) || f2fs_encrypted_inode(new_dir)) &&
863 (old_dir != new_dir) &&
864 (!fscrypt_has_permitted_context(new_dir, old_inode) ||
865 !fscrypt_has_permitted_context(old_dir, new_inode)))
866 return -EPERM;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip