lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 16 Mar 2023 19:28:31 +0800 From: Baokun Li <libaokun1@...wei.com> To: <linux-ext4@...r.kernel.org> CC: <tytso@....edu>, <adilger.kernel@...ger.ca>, <jack@...e.cz>, <ritesh.list@...il.com>, <linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>, <yangerkun@...wei.com>, <yukuai3@...wei.com>, <libaokun1@...wei.com> Subject: [PATCH 2/3] ext4: add helper to check if flag is changed by ctx Add helper to check if flag will be changed, return 1 means it will be set, -1 means it will be cleared, 0 means it will not be changed. Signed-off-by: Baokun Li <libaokun1@...wei.com> --- fs/ext4/super.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 5b4a323c218b..fefcd42f34ea 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2042,13 +2042,26 @@ ctx_test_##name(struct ext4_fs_context *ctx, unsigned long flag) \ return (ctx->vals_s_##name & flag); \ } +#define EXT4_CHANGED_CTX(name) \ +static inline int \ +ctx_changed_##name(struct ext4_fs_context *ctx, unsigned long flag) \ +{ \ + if (ctx->vals_s_##name & flag) \ + return 1; \ + if (ctx->mask_s_##name & flag) \ + return -1; \ + return 0; \ +} + EXT4_SET_CTX(flags); /* set only */ EXT4_SET_CTX(mount_opt); EXT4_CLEAR_CTX(mount_opt); EXT4_TEST_CTX(mount_opt); +EXT4_CHANGED_CTX(mount_opt); EXT4_SET_CTX(mount_opt2); EXT4_CLEAR_CTX(mount_opt2); EXT4_TEST_CTX(mount_opt2); +EXT4_CHANGED_CTX(mount_opt2); static inline void ctx_set_mount_flag(struct ext4_fs_context *ctx, int bit) { @@ -2537,9 +2550,7 @@ static int ext4_check_quota_consistency(struct fs_context *fc, quota_flags = EXT4_MOUNT_QUOTA | EXT4_MOUNT_USRQUOTA | EXT4_MOUNT_GRPQUOTA | EXT4_MOUNT_PRJQUOTA; - if (quota_loaded && - ctx->mask_s_mount_opt & quota_flags && - !ctx_test_mount_opt(ctx, quota_flags)) + if (quota_loaded && (ctx_changed_mount_opt(ctx, quota_flags) < 0)) goto err_quota_change; if (ctx->spec & EXT4_SPEC_JQUOTA) { -- 2.31.1
Powered by blists - more mailing lists