mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-29 09:13:38 +00:00
9p: move xattr-related structs to .rodata
This makes it harder for accidental or malicious changes to v9fs_xattr_user_handler, v9fs_xattr_trusted_handler, v9fs_xattr_security_handler, or v9fs_xattr_handlers at runtime. Cc: Eric Van Hensbergen <ericvh@kernel.org> Cc: Latchesar Ionkov <lucho@ionkov.net> Cc: Dominique Martinet <asmadeus@codewreck.org> Cc: Christian Schoenebeck <linux_oss@crudebyte.com> Cc: v9fs@lists.linux.dev Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> Link: https://lore.kernel.org/r/20230930050033.41174-4-wedsonaf@gmail.com Acked-by: Dominique Martinet <asmadeus@codewreck.org> Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
e60ac12833
commit
b6079dc9cb
@ -162,27 +162,27 @@ static int v9fs_xattr_handler_set(const struct xattr_handler *handler,
|
|||||||
return v9fs_xattr_set(dentry, full_name, value, size, flags);
|
return v9fs_xattr_set(dentry, full_name, value, size, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xattr_handler v9fs_xattr_user_handler = {
|
static const struct xattr_handler v9fs_xattr_user_handler = {
|
||||||
.prefix = XATTR_USER_PREFIX,
|
.prefix = XATTR_USER_PREFIX,
|
||||||
.get = v9fs_xattr_handler_get,
|
.get = v9fs_xattr_handler_get,
|
||||||
.set = v9fs_xattr_handler_set,
|
.set = v9fs_xattr_handler_set,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct xattr_handler v9fs_xattr_trusted_handler = {
|
static const struct xattr_handler v9fs_xattr_trusted_handler = {
|
||||||
.prefix = XATTR_TRUSTED_PREFIX,
|
.prefix = XATTR_TRUSTED_PREFIX,
|
||||||
.get = v9fs_xattr_handler_get,
|
.get = v9fs_xattr_handler_get,
|
||||||
.set = v9fs_xattr_handler_set,
|
.set = v9fs_xattr_handler_set,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_9P_FS_SECURITY
|
#ifdef CONFIG_9P_FS_SECURITY
|
||||||
static struct xattr_handler v9fs_xattr_security_handler = {
|
static const struct xattr_handler v9fs_xattr_security_handler = {
|
||||||
.prefix = XATTR_SECURITY_PREFIX,
|
.prefix = XATTR_SECURITY_PREFIX,
|
||||||
.get = v9fs_xattr_handler_get,
|
.get = v9fs_xattr_handler_get,
|
||||||
.set = v9fs_xattr_handler_set,
|
.set = v9fs_xattr_handler_set,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const struct xattr_handler *v9fs_xattr_handlers[] = {
|
const struct xattr_handler * const v9fs_xattr_handlers[] = {
|
||||||
&v9fs_xattr_user_handler,
|
&v9fs_xattr_user_handler,
|
||||||
&v9fs_xattr_trusted_handler,
|
&v9fs_xattr_trusted_handler,
|
||||||
#ifdef CONFIG_9P_FS_SECURITY
|
#ifdef CONFIG_9P_FS_SECURITY
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <net/9p/9p.h>
|
#include <net/9p/9p.h>
|
||||||
#include <net/9p/client.h>
|
#include <net/9p/client.h>
|
||||||
|
|
||||||
extern const struct xattr_handler *v9fs_xattr_handlers[];
|
extern const struct xattr_handler * const v9fs_xattr_handlers[];
|
||||||
|
|
||||||
ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
|
ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
|
||||||
void *buffer, size_t buffer_size);
|
void *buffer, size_t buffer_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user