Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jffs2: move jffs2_xattr_handlers to .rodata

This makes it harder for accidental or malicious changes to
jffs2_xattr_handlers at runtime.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
Link: https://lore.kernel.org/r/20230930050033.41174-16-wedsonaf@gmail.com
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Wedson Almeida Filho and committed by
Christian Brauner
13a75c3a 2c323f2c

+2 -2
+1 -1
fs/jffs2/xattr.c
··· 920 920 * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) 921 921 * is an implementation of setxattr handler on jffs2. 922 922 * -------------------------------------------------- */ 923 - const struct xattr_handler *jffs2_xattr_handlers[] = { 923 + const struct xattr_handler * const jffs2_xattr_handlers[] = { 924 924 &jffs2_user_xattr_handler, 925 925 #ifdef CONFIG_JFFS2_FS_SECURITY 926 926 &jffs2_security_xattr_handler,
+1 -1
fs/jffs2/xattr.h
··· 94 94 extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, 95 95 const char *buffer, size_t size, int flags); 96 96 97 - extern const struct xattr_handler *jffs2_xattr_handlers[]; 97 + extern const struct xattr_handler * const jffs2_xattr_handlers[]; 98 98 extern const struct xattr_handler jffs2_user_xattr_handler; 99 99 extern const struct xattr_handler jffs2_trusted_xattr_handler; 100 100