]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
security_dentry_init_security(): constify qstr argument
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 5 Feb 2024 02:25:18 +0000 (21:25 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 16 Sep 2025 01:08:33 +0000 (21:08 -0400)
Nothing outside of fs/dcache.c has any business modifying
dentry names; passing &dentry->d_name as an argument should
have that argument declared as a const pointer.

Acked-by: Casey Schaufler <casey@schaufler-ca.com> # smack part
Acked-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/lsm_hook_defs.h
include/linux/security.h
security/security.c
security/selinux/hooks.c
security/smack/smack_lsm.c

index fd11fffdd3c38045eafe6ebd20b77a1fc8a7a74f..aa4d6ec9c98b8dfa735b256107953b1d1fed0d1b 100644 (file)
@@ -85,7 +85,7 @@ LSM_HOOK(int, -EOPNOTSUPP, dentry_init_security, struct dentry *dentry,
         int mode, const struct qstr *name, const char **xattr_name,
         struct lsm_context *cp)
 LSM_HOOK(int, 0, dentry_create_files_as, struct dentry *dentry, int mode,
-        struct qstr *name, const struct cred *old, struct cred *new)
+        const struct qstr *name, const struct cred *old, struct cred *new)
 
 #ifdef CONFIG_SECURITY_PATH
 LSM_HOOK(int, 0, path_unlink, const struct path *dir, struct dentry *dentry)
index 521bcb5b97170c7f9b0abd79fc6fe756d4ff29ee..3f694d3ebd70204fe67996765a373b7ef3f0f6ea 100644 (file)
@@ -391,7 +391,7 @@ int security_dentry_init_security(struct dentry *dentry, int mode,
                                  const char **xattr_name,
                                  struct lsm_context *lsmcxt);
 int security_dentry_create_files_as(struct dentry *dentry, int mode,
-                                       struct qstr *name,
+                                       const struct qstr *name,
                                        const struct cred *old,
                                        struct cred *new);
 int security_path_notify(const struct path *path, u64 mask,
@@ -871,7 +871,7 @@ static inline int security_dentry_init_security(struct dentry *dentry,
 }
 
 static inline int security_dentry_create_files_as(struct dentry *dentry,
-                                                 int mode, struct qstr *name,
+                                                 int mode, const struct qstr *name,
                                                  const struct cred *old,
                                                  struct cred *new)
 {
index ad163f06bf7abc4327f9918f11b903e1649ef35e..db2d75be87cccbc3febb273421694923113c00b2 100644 (file)
@@ -1775,7 +1775,7 @@ EXPORT_SYMBOL(security_dentry_init_security);
  * Return: Returns 0 on success, error on failure.
  */
 int security_dentry_create_files_as(struct dentry *dentry, int mode,
-                                   struct qstr *name,
+                                   const struct qstr *name,
                                    const struct cred *old, struct cred *new)
 {
        return call_int_hook(dentry_create_files_as, dentry, mode,
index c95a5874bf7d405d828e20fa0d8e997c02ee213b..58ce499542064f990ba51b31ba7ebcbef2623b10 100644 (file)
@@ -2901,7 +2901,7 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode,
 }
 
 static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,
-                                         struct qstr *name,
+                                         const struct qstr *name,
                                          const struct cred *old,
                                          struct cred *new)
 {
index fc340a6f0ddea83ada1bff2a361eb39bef0813a1..5caa372ffbf324b2ea4a3daefed7b7fd54120610 100644 (file)
@@ -4908,7 +4908,7 @@ static int smack_inode_copy_up_xattr(struct dentry *src, const char *name)
 }
 
 static int smack_dentry_create_files_as(struct dentry *dentry, int mode,
-                                       struct qstr *name,
+                                       const struct qstr *name,
                                        const struct cred *old,
                                        struct cred *new)
 {