ioctl.c (9d4d8572a539ef807e21c196f145aa365fd52f0e) ioctl.c (e17fe6579de023725ec22a16965e9099e4a05ac9)
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)

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

1152 handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1);
1153 if (IS_ERR(handle)) {
1154 err = PTR_ERR(handle);
1155 goto pwsalt_err_exit;
1156 }
1157 err = ext4_journal_get_write_access(handle, sbi->s_sbh);
1158 if (err)
1159 goto pwsalt_err_journal;
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)

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

1152 handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1);
1153 if (IS_ERR(handle)) {
1154 err = PTR_ERR(handle);
1155 goto pwsalt_err_exit;
1156 }
1157 err = ext4_journal_get_write_access(handle, sbi->s_sbh);
1158 if (err)
1159 goto pwsalt_err_journal;
1160 lock_buffer(sbi->s_sbh);
1160 generate_random_uuid(sbi->s_es->s_encrypt_pw_salt);
1161 generate_random_uuid(sbi->s_es->s_encrypt_pw_salt);
1162 ext4_superblock_csum_set(sb);
1163 unlock_buffer(sbi->s_sbh);
1161 err = ext4_handle_dirty_metadata(handle, NULL,
1162 sbi->s_sbh);
1163 pwsalt_err_journal:
1164 err2 = ext4_journal_stop(handle);
1165 if (err2 && !err)
1166 err = err2;
1167 pwsalt_err_exit:
1168 mnt_drop_write_file(filp);

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

1301 return -EOPNOTSUPP;
1302 return fsverity_ioctl_enable(filp, (const void __user *)arg);
1303
1304 case FS_IOC_MEASURE_VERITY:
1305 if (!ext4_has_feature_verity(sb))
1306 return -EOPNOTSUPP;
1307 return fsverity_ioctl_measure(filp, (void __user *)arg);
1308
1164 err = ext4_handle_dirty_metadata(handle, NULL,
1165 sbi->s_sbh);
1166 pwsalt_err_journal:
1167 err2 = ext4_journal_stop(handle);
1168 if (err2 && !err)
1169 err = err2;
1170 pwsalt_err_exit:
1171 mnt_drop_write_file(filp);

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

1304 return -EOPNOTSUPP;
1305 return fsverity_ioctl_enable(filp, (const void __user *)arg);
1306
1307 case FS_IOC_MEASURE_VERITY:
1308 if (!ext4_has_feature_verity(sb))
1309 return -EOPNOTSUPP;
1310 return fsverity_ioctl_measure(filp, (void __user *)arg);
1311
1312 case FS_IOC_READ_VERITY_METADATA:
1313 if (!ext4_has_feature_verity(sb))
1314 return -EOPNOTSUPP;
1315 return fsverity_ioctl_read_metadata(filp,
1316 (const void __user *)arg);
1317
1309 default:
1310 return -ENOTTY;
1311 }
1312}
1313
1314long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1315{
1316 long ret;

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

1383 case FS_IOC_REMOVE_ENCRYPTION_KEY:
1384 case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
1385 case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
1386 case FS_IOC_GET_ENCRYPTION_NONCE:
1387 case EXT4_IOC_SHUTDOWN:
1388 case FS_IOC_GETFSMAP:
1389 case FS_IOC_ENABLE_VERITY:
1390 case FS_IOC_MEASURE_VERITY:
1318 default:
1319 return -ENOTTY;
1320 }
1321}
1322
1323long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
1324{
1325 long ret;

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

1392 case FS_IOC_REMOVE_ENCRYPTION_KEY:
1393 case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
1394 case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
1395 case FS_IOC_GET_ENCRYPTION_NONCE:
1396 case EXT4_IOC_SHUTDOWN:
1397 case FS_IOC_GETFSMAP:
1398 case FS_IOC_ENABLE_VERITY:
1399 case FS_IOC_MEASURE_VERITY:
1400 case FS_IOC_READ_VERITY_METADATA:
1391 case EXT4_IOC_CLEAR_ES_CACHE:
1392 case EXT4_IOC_GETSTATE:
1393 case EXT4_IOC_GET_ES_CACHE:
1394 case FS_IOC_FSGETXATTR:
1395 case FS_IOC_FSSETXATTR:
1396 break;
1397 default:
1398 return -ENOIOCTLCMD;
1399 }
1400 return ext4_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
1401}
1402#endif
1401 case EXT4_IOC_CLEAR_ES_CACHE:
1402 case EXT4_IOC_GETSTATE:
1403 case EXT4_IOC_GET_ES_CACHE:
1404 case FS_IOC_FSGETXATTR:
1405 case FS_IOC_FSSETXATTR:
1406 break;
1407 default:
1408 return -ENOIOCTLCMD;
1409 }
1410 return ext4_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
1411}
1412#endif