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>
This commit is contained in:
Wedson Almeida Filho 2023-09-30 02:00:19 -03:00 committed by Christian Brauner
parent 2c323f2c56
commit 13a75c3abc
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2
2 changed files with 2 additions and 2 deletions

View file

@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
* do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags)
* is an implementation of setxattr handler on jffs2. * is an implementation of setxattr handler on jffs2.
* -------------------------------------------------- */ * -------------------------------------------------- */
const struct xattr_handler *jffs2_xattr_handlers[] = { const struct xattr_handler * const jffs2_xattr_handlers[] = {
&jffs2_user_xattr_handler, &jffs2_user_xattr_handler,
#ifdef CONFIG_JFFS2_FS_SECURITY #ifdef CONFIG_JFFS2_FS_SECURITY
&jffs2_security_xattr_handler, &jffs2_security_xattr_handler,

View file

@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname
extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname,
const char *buffer, size_t size, int flags); const char *buffer, size_t size, int flags);
extern const struct xattr_handler *jffs2_xattr_handlers[]; extern const struct xattr_handler * const jffs2_xattr_handlers[];
extern const struct xattr_handler jffs2_user_xattr_handler; extern const struct xattr_handler jffs2_user_xattr_handler;
extern const struct xattr_handler jffs2_trusted_xattr_handler; extern const struct xattr_handler jffs2_trusted_xattr_handler;