reiserfs: move reiserfs_xattr_handlers to .rodata
authorWedson Almeida Filho <walmeida@microsoft.com>
Sat, 30 Sep 2023 05:00:26 +0000 (02:00 -0300)
committerChristian Brauner <brauner@kernel.org>
Tue, 10 Oct 2023 11:49:19 +0000 (13:49 +0200)
This makes it harder for accidental or malicious changes to
reiserfs_xattr_handlers at runtime.

Cc: reiserfs-devel@vger.kernel.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
Link: https://lore.kernel.org/r/20230930050033.41174-23-wedsonaf@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/reiserfs/reiserfs.h
fs/reiserfs/xattr.c

index b81749492ef98e61bd22218c585864d9a9986953..ed154bf26c53463017d097035948066a133ce0ee 100644 (file)
@@ -1165,7 +1165,7 @@ static inline int bmap_would_wrap(unsigned bmap_nr)
        return bmap_nr > ((1LL << 16) - 1);
 }
 
-extern const struct xattr_handler *reiserfs_xattr_handlers[];
+extern const struct xattr_handler * const reiserfs_xattr_handlers[];
 
 /*
  * this says about version of key of all items (but stat data) the
index 6000964c2b80d052e48577ce94dc050158ddc756..998035a6388e7403e511bdd05e90e0f131624d98 100644 (file)
@@ -780,7 +780,7 @@ static inline bool reiserfs_posix_acl_list(const char *name,
 }
 
 /* This is the implementation for the xattr plugin infrastructure */
-static inline bool reiserfs_xattr_list(const struct xattr_handler **handlers,
+static inline bool reiserfs_xattr_list(const struct xattr_handler * const *handlers,
                                       const char *name, struct dentry *dentry)
 {
        if (handlers) {
@@ -911,7 +911,7 @@ static int create_privroot(struct dentry *dentry) { return 0; }
 #endif
 
 /* Actual operations that are exported to VFS-land */
-const struct xattr_handler *reiserfs_xattr_handlers[] = {
+const struct xattr_handler * const reiserfs_xattr_handlers[] = {
 #ifdef CONFIG_REISERFS_FS_XATTR
        &reiserfs_xattr_user_handler,
        &reiserfs_xattr_trusted_handler,