diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig index 4d22ecfe0fa..a618d0bda7b 100644 --- a/fs/reiserfs/Kconfig +++ b/fs/reiserfs/Kconfig @@ -88,3 +88,18 @@ config REISERFS_FS_SECURITY If you are not using a security module that requires using extended attributes for file security labels, say N. + +config REISERFS_FS_SECURITY_INIT + bool "ReiserFS Security Labels initialization" + depends on REISERFS_FS_XATTR + default false + help + Init new inodes with security labels provided by LSMs. + + It was broken from the beginning, since the xattr name was + missing the 'security.' prefix. + + Enabling this option might cause lockdep warnings and + ultimately deadlocks. + + If unsure, say N. diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 929acce6e73..b427d03d0ea 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -1654,6 +1654,9 @@ static int read_super_block(struct super_block *s, int offset) reiserfs_warning(NULL, "", "reiserfs filesystem is deprecated and " "scheduled to be removed from the kernel in 2025"); + if (IS_ENABLED(CONFIG_REISERFS_FS_SECURITY_INIT)) + reiserfs_warning(NULL, "", "initializing security xattrs can cause deadlocks"); + SB_BUFFER_WITH_SB(s) = bh; SB_DISK_SUPER_BLOCK(s) = rs; diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 078dd8cc312..d82c4507803 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c @@ -69,6 +69,9 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode, sec->value = NULL; sec->length = 0; + if (!IS_ENABLED(CONFIG_REISERFS_FS_SECURITY_INIT)) + return 0; + /* Don't add selinux attributes on xattrs - they'll never get used */ if (IS_PRIVATE(dir)) return 0;