summaryrefslogtreecommitdiffstats
path: root/fs/kernfs
diff options
context:
space:
mode:
authorWedson Almeida Filho <walmeida@microsoft.com>2023-09-30 07:00:21 +0200
committerChristian Brauner <brauner@kernel.org>2023-10-09 16:24:20 +0200
commitffb2e06508279ced466d60164105da3f5c1b14be (patch)
tree742b1d4c7f9e701d47e04894b0b9806d2b3f4d14 /fs/kernfs
parentjfs: move jfs_xattr_handlers to .rodata (diff)
downloadlinux-ffb2e06508279ced466d60164105da3f5c1b14be.tar.xz
linux-ffb2e06508279ced466d60164105da3f5c1b14be.zip
kernfs: move kernfs_xattr_handlers to .rodata
This makes it harder for accidental or malicious changes to kernfs_xattr_handlers at runtime. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> Link: https://lore.kernel.org/r/20230930050033.41174-18-wedsonaf@gmail.com Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r--fs/kernfs/inode.c2
-rw-r--r--fs/kernfs/kernfs-internal.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 922719a343a7..f258ce9c0d1b 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -445,7 +445,7 @@ static const struct xattr_handler kernfs_user_xattr_handler = {
.set = kernfs_vfs_user_xattr_set,
};
-const struct xattr_handler *kernfs_xattr_handlers[] = {
+const struct xattr_handler * const kernfs_xattr_handlers[] = {
&kernfs_trusted_xattr_handler,
&kernfs_security_xattr_handler,
&kernfs_user_xattr_handler,
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index a9b854cdfdb5..237f2764b941 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -127,7 +127,7 @@ extern struct kmem_cache *kernfs_node_cache, *kernfs_iattrs_cache;
/*
* inode.c
*/
-extern const struct xattr_handler *kernfs_xattr_handlers[];
+extern const struct xattr_handler * const kernfs_xattr_handlers[];
void kernfs_evict_inode(struct inode *inode);
int kernfs_iop_permission(struct mnt_idmap *idmap,
struct inode *inode, int mask);