ioctl.c (3eb66e91a25497065c5322b1268cbc3953642227) ioctl.c (643fa9612bf1a29153eee46fd398117632f93cbe)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/ioctl.c
4 *
5 * Copyright (C) 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 111 unchanged lines hidden (view full) ---

120 IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) ||
121 ext4_has_inline_data(inode))
122 return -EINVAL;
123
124 if (IS_RDONLY(inode) || IS_APPEND(inode) || IS_IMMUTABLE(inode) ||
125 !inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN))
126 return -EPERM;
127
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/ext4/ioctl.c
4 *
5 * Copyright (C) 1993, 1994, 1995
6 * Remy Card (card@masi.ibp.fr)
7 * Laboratoire MASI - Institut Blaise Pascal
8 * Universite Pierre et Marie Curie (Paris VI)

--- 111 unchanged lines hidden (view full) ---

120 IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) ||
121 ext4_has_inline_data(inode))
122 return -EINVAL;
123
124 if (IS_RDONLY(inode) || IS_APPEND(inode) || IS_IMMUTABLE(inode) ||
125 !inode_owner_or_capable(inode) || !capable(CAP_SYS_ADMIN))
126 return -EPERM;
127
128 inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO);
128 inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO, EXT4_IGET_SPECIAL);
129 if (IS_ERR(inode_bl))
130 return PTR_ERR(inode_bl);
131 ei_bl = EXT4_I(inode_bl);
132
133 filemap_flush(inode->i_mapping);
134 filemap_flush(inode_bl->i_mapping);
135
136 /* Protect orig inodes against a truncate and make sure,

--- 68 unchanged lines hidden (view full) ---

205 ext4_double_up_write_data_sem(inode, inode_bl);
206
207journal_err_out:
208 unlock_two_nondirectories(inode, inode_bl);
209 iput(inode_bl);
210 return err;
211}
212
129 if (IS_ERR(inode_bl))
130 return PTR_ERR(inode_bl);
131 ei_bl = EXT4_I(inode_bl);
132
133 filemap_flush(inode->i_mapping);
134 filemap_flush(inode_bl->i_mapping);
135
136 /* Protect orig inodes against a truncate and make sure,

--- 68 unchanged lines hidden (view full) ---

205 ext4_double_up_write_data_sem(inode, inode_bl);
206
207journal_err_out:
208 unlock_two_nondirectories(inode, inode_bl);
209 iput(inode_bl);
210 return err;
211}
212
213#ifdef CONFIG_EXT4_FS_ENCRYPTION
213#ifdef CONFIG_FS_ENCRYPTION
214static int uuid_is_zero(__u8 u[16])
215{
216 int i;
217
218 for (i = 0; i < 16; i++)
219 if (u[i])
220 return 0;
221 return 1;

--- 751 unchanged lines hidden (view full) ---

973 return ext4_ext_precache(inode);
974
975 case EXT4_IOC_SET_ENCRYPTION_POLICY:
976 if (!ext4_has_feature_encrypt(sb))
977 return -EOPNOTSUPP;
978 return fscrypt_ioctl_set_policy(filp, (const void __user *)arg);
979
980 case EXT4_IOC_GET_ENCRYPTION_PWSALT: {
214static int uuid_is_zero(__u8 u[16])
215{
216 int i;
217
218 for (i = 0; i < 16; i++)
219 if (u[i])
220 return 0;
221 return 1;

--- 751 unchanged lines hidden (view full) ---

973 return ext4_ext_precache(inode);
974
975 case EXT4_IOC_SET_ENCRYPTION_POLICY:
976 if (!ext4_has_feature_encrypt(sb))
977 return -EOPNOTSUPP;
978 return fscrypt_ioctl_set_policy(filp, (const void __user *)arg);
979
980 case EXT4_IOC_GET_ENCRYPTION_PWSALT: {
981#ifdef CONFIG_EXT4_FS_ENCRYPTION
981#ifdef CONFIG_FS_ENCRYPTION
982 int err, err2;
983 struct ext4_sb_info *sbi = EXT4_SB(sb);
984 handle_t *handle;
985
986 if (!ext4_has_feature_encrypt(sb))
987 return -EOPNOTSUPP;
988 if (uuid_is_zero(sbi->s_es->s_encrypt_pw_salt)) {
989 err = mnt_want_write_file(filp);

--- 160 unchanged lines hidden ---
982 int err, err2;
983 struct ext4_sb_info *sbi = EXT4_SB(sb);
984 handle_t *handle;
985
986 if (!ext4_has_feature_encrypt(sb))
987 return -EOPNOTSUPP;
988 if (uuid_is_zero(sbi->s_es->s_encrypt_pw_salt)) {
989 err = mnt_want_write_file(filp);

--- 160 unchanged lines hidden ---