linux-stable/fs/quota
Eric Biggers 0b98335ade quota: explicitly forbid quota files from being encrypted
commit d3cc1b0be2 upstream.

Since commit d7e7b9af10 ("fscrypt: stop using keyrings subsystem for
fscrypt_master_key"), xfstest generic/270 causes a WARNING when run on
f2fs with test_dummy_encryption in the mount options:

$ kvm-xfstests -c f2fs/encrypt generic/270
[...]
WARNING: CPU: 1 PID: 2453 at fs/crypto/keyring.c:240 fscrypt_destroy_keyring+0x1f5/0x260

The cause of the WARNING is that not all encrypted inodes have been
evicted before fscrypt_destroy_keyring() is called, which violates an
assumption.  This happens because the test uses an external quota file,
which gets automatically encrypted due to test_dummy_encryption.

Encryption of quota files has never really been supported.  On ext4,
ext4_quota_read() does not decrypt the data, so encrypted quota files
are always considered invalid on ext4.  On f2fs, f2fs_quota_read() uses
the pagecache, so trying to use an encrypted quota file gets farther,
resulting in the issue described above being possible.  But this was
never intended to be possible, and there is no use case for it.

Therefore, make the quota support layer explicitly reject using
IS_ENCRYPTED inodes when quotaon is attempted.

Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20230905003227.326998-1-ebiggers@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 17:20:04 +00:00
..
compat.h quota: simplify the quotactl compat handling 2020-09-17 13:00:46 -04:00
dquot.c quota: explicitly forbid quota files from being encrypted 2023-11-28 17:20:04 +00:00
Kconfig quota: mark PRINT_QUOTA_WARNING as BROKEN 2023-04-14 13:06:50 +02:00
kqid.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile quota: simplify the quotactl compat handling 2020-09-17 13:00:46 -04:00
netlink.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quota.c fs: Drop wait_unfrozen wait queue 2023-05-30 15:36:40 +02:00
quota_tree.c quota: Add more checking after reading from quota file 2022-09-29 15:37:30 +02:00
quota_tree.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quota_v1.c quota: fixup *_write_file_info() to return proper error code 2023-03-20 17:27:42 +01:00
quota_v2.c quota: fixup *_write_file_info() to return proper error code 2023-03-20 17:27:42 +01:00
quotaio_v1.h quota: avoid time_t in v1_disk_dqblk definition 2019-12-16 14:15:30 +01:00
quotaio_v2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00