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

VFS: rename lookup_one_len family to lookup_noperm and remove permission check

The lookup_one_len family of functions is (now) only used internally by
a filesystem on itself either
- in a context where permission checking is irrelevant such as by a
virtual filesystem populating itself, or xfs accessing its ORPHANAGE
or dquota accessing the quota file; or
- in a context where a permission check (MAY_EXEC on the parent) has just
been performed such as a network filesystem finding in "silly-rename"
file in the same directory. This is also the context after the
_parentat() functions where currently lookup_one_qstr_excl() is used.

So the permission check is pointless.

The name "one_len" is unhelpful in understanding the purpose of these
functions and should be changed. Most of the callers pass the len as
"strlen()" so using a qstr and QSTR() can simplify the code.

This patch renames these functions (include lookup_positive_unlocked()
which is part of the family despite the name) to have a name based on
"lookup_noperm". They are changed to receive a 'struct qstr' instead
of separate name and len. In a few cases the use of QSTR() results in a
new call to strlen().

try_lookup_noperm() takes a pointer to a qstr instead of the whole
qstr. This is consistent with d_hash_and_lookup() (which is nearly
identical) and useful for lookup_noperm_unlocked().

The new lookup_noperm_common() doesn't take a qstr yet. That will be
tidied up in a subsequent patch.

Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/r/20250319031545.2999807-5-neil@brown.name
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

NeilBrown and committed by
Christian Brauner
fa6fe07d 2011067c

+122 -87
+20
Documentation/filesystems/porting.rst
··· 1212 1212 take a qstr instead of a name and len. These, not the "one_len" 1213 1213 versions, should be used whenever accessing a filesystem from outside 1214 1214 that filesysmtem, through a mount point - which will have a mnt_idmap. 1215 + 1216 + --- 1217 + 1218 + ** mandatory** 1219 + 1220 + Functions try_lookup_one_len(), lookup_one_len(), 1221 + lookup_one_len_unlocked() and lookup_positive_unlocked() have been 1222 + renamed to try_lookup_noperm(), lookup_noperm(), 1223 + lookup_noperm_unlocked(), lookup_noperm_positive_unlocked(). They now 1224 + take a qstr instead of separate name and length. QSTR() can be used 1225 + when strlen() is needed for the length. 1226 + 1227 + For try_lookup_noperm() a reference to the qstr is passed in case the 1228 + hash might subsequently be needed. 1229 + 1230 + These function no longer do any permission checking - they previously 1231 + checked that the caller has 'X' permission on the parent. They must 1232 + ONLY be used internally by a filesystem on itself when it knows that 1233 + permissions are irrelevant or in a context where permission checks have 1234 + already been performed such as after vfs_path_parent_lookup()
+1 -1
arch/s390/hypfs/inode.c
··· 342 342 struct inode *inode; 343 343 344 344 inode_lock(d_inode(parent)); 345 - dentry = lookup_one_len(name, parent, strlen(name)); 345 + dentry = lookup_noperm(&QSTR(name), parent); 346 346 if (IS_ERR(dentry)) { 347 347 dentry = ERR_PTR(-ENOMEM); 348 348 goto fail;
+2 -2
drivers/android/binderfs.c
··· 187 187 inode_lock(d_inode(root)); 188 188 189 189 /* look it up */ 190 - dentry = lookup_one_len(name, root, name_len); 190 + dentry = lookup_noperm(&QSTR(name), root); 191 191 if (IS_ERR(dentry)) { 192 192 inode_unlock(d_inode(root)); 193 193 ret = PTR_ERR(dentry); ··· 487 487 { 488 488 struct dentry *dentry; 489 489 490 - dentry = lookup_one_len(name, parent, strlen(name)); 490 + dentry = lookup_noperm(&QSTR(name), parent); 491 491 if (IS_ERR(dentry)) 492 492 return dentry; 493 493
+2 -2
drivers/infiniband/hw/qib/qib_fs.c
··· 90 90 int error; 91 91 92 92 inode_lock(d_inode(parent)); 93 - *dentry = lookup_one_len(name, parent, strlen(name)); 93 + *dentry = lookup_noperm(&QSTR(name), parent); 94 94 if (!IS_ERR(*dentry)) 95 95 error = qibfs_mknod(d_inode(parent), *dentry, 96 96 mode, fops, data); ··· 433 433 char unit[10]; 434 434 435 435 snprintf(unit, sizeof(unit), "%u", dd->unit); 436 - dir = lookup_one_len_unlocked(unit, sb->s_root, strlen(unit)); 436 + dir = lookup_noperm_unlocked(&QSTR(unit), sb->s_root); 437 437 438 438 if (IS_ERR(dir)) { 439 439 pr_err("Lookup of %s failed\n", unit);
+1 -1
fs/afs/dir.c
··· 943 943 } 944 944 945 945 strcpy(p, name); 946 - ret = lookup_one_len(buf, dentry->d_parent, len); 946 + ret = lookup_noperm(&QSTR(buf), dentry->d_parent); 947 947 if (IS_ERR(ret) || d_is_positive(ret)) 948 948 goto out_s; 949 949 dput(ret);
+2 -4
fs/afs/dir_silly.c
··· 113 113 114 114 sdentry = NULL; 115 115 do { 116 - int slen; 117 - 118 116 dput(sdentry); 119 117 sillycounter++; 120 118 121 119 /* Create a silly name. Note that the ".__afs" prefix is 122 120 * understood by the salvager and must not be changed. 123 121 */ 124 - slen = scnprintf(silly, sizeof(silly), ".__afs%04X", sillycounter); 125 - sdentry = lookup_one_len(silly, dentry->d_parent, slen); 122 + scnprintf(silly, sizeof(silly), ".__afs%04X", sillycounter); 123 + sdentry = lookup_noperm(&QSTR(silly), dentry->d_parent); 126 124 127 125 /* N.B. Better to return EBUSY here ... it could be dangerous 128 126 * to delete the file while it's in use.
+2 -1
fs/autofs/dev-ioctl.c
··· 459 459 "the parent autofs mount timeout which could " 460 460 "prevent shutdown\n"); 461 461 462 - dentry = try_lookup_one_len(param->path, base, path_len); 462 + dentry = try_lookup_noperm(&QSTR_LEN(param->path, path_len), 463 + base); 463 464 if (IS_ERR_OR_NULL(dentry)) 464 465 return dentry ? PTR_ERR(dentry) : -ENOENT; 465 466 ino = autofs_dentry_ino(dentry);
+1 -1
fs/binfmt_misc.c
··· 842 842 } 843 843 844 844 inode_lock(d_inode(root)); 845 - dentry = lookup_one_len(e->name, root, strlen(e->name)); 845 + dentry = lookup_noperm(&QSTR(e->name), root); 846 846 err = PTR_ERR(dentry); 847 847 if (IS_ERR(dentry)) 848 848 goto out;
+3 -3
fs/debugfs/inode.c
··· 346 346 if (!parent) 347 347 parent = debugfs_mount->mnt_root; 348 348 349 - dentry = lookup_positive_unlocked(name, parent, strlen(name)); 349 + dentry = lookup_noperm_positive_unlocked(&QSTR(name), parent); 350 350 if (IS_ERR(dentry)) 351 351 return NULL; 352 352 return dentry; ··· 388 388 if (unlikely(IS_DEADDIR(d_inode(parent)))) 389 389 dentry = ERR_PTR(-ENOENT); 390 390 else 391 - dentry = lookup_one_len(name, parent, strlen(name)); 391 + dentry = lookup_noperm(&QSTR(name), parent); 392 392 if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { 393 393 if (d_is_dir(dentry)) 394 394 pr_err("Directory '%s' with parent '%s' already present!\n", ··· 872 872 } 873 873 if (strcmp(old_name.name.name, new_name) == 0) 874 874 goto out; 875 - target = lookup_one_len(new_name, parent, strlen(new_name)); 875 + target = lookup_noperm(&QSTR(new_name), parent); 876 876 if (IS_ERR(target)) { 877 877 error = PTR_ERR(target); 878 878 goto out;
+9 -7
fs/ecryptfs/inode.c
··· 394 394 char *encrypted_and_encoded_name = NULL; 395 395 struct ecryptfs_mount_crypt_stat *mount_crypt_stat; 396 396 struct dentry *lower_dir_dentry, *lower_dentry; 397 - const char *name = ecryptfs_dentry->d_name.name; 398 - size_t len = ecryptfs_dentry->d_name.len; 397 + struct qstr qname = QSTR_INIT(ecryptfs_dentry->d_name.name, 398 + ecryptfs_dentry->d_name.len); 399 399 struct dentry *res; 400 400 int rc = 0; 401 401 ··· 404 404 mount_crypt_stat = &ecryptfs_superblock_to_private( 405 405 ecryptfs_dentry->d_sb)->mount_crypt_stat; 406 406 if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { 407 + size_t len = qname.len; 407 408 rc = ecryptfs_encrypt_and_encode_filename( 408 409 &encrypted_and_encoded_name, &len, 409 - mount_crypt_stat, name, len); 410 + mount_crypt_stat, qname.name, len); 410 411 if (rc) { 411 412 printk(KERN_ERR "%s: Error attempting to encrypt and encode " 412 413 "filename; rc = [%d]\n", __func__, rc); 413 414 return ERR_PTR(rc); 414 415 } 415 - name = encrypted_and_encoded_name; 416 + qname.name = encrypted_and_encoded_name; 417 + qname.len = len; 416 418 } 417 419 418 - lower_dentry = lookup_one_len_unlocked(name, lower_dir_dentry, len); 420 + lower_dentry = lookup_noperm_unlocked(&qname, lower_dir_dentry); 419 421 if (IS_ERR(lower_dentry)) { 420 - ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " 422 + ecryptfs_printk(KERN_DEBUG, "%s: lookup_noperm() returned " 421 423 "[%ld] on lower_dentry = [%s]\n", __func__, 422 424 PTR_ERR(lower_dentry), 423 - name); 425 + qname.name); 424 426 res = ERR_CAST(lower_dentry); 425 427 } else { 426 428 res = ecryptfs_lookup_interpose(ecryptfs_dentry, lower_dentry);
+1 -1
fs/kernfs/mount.c
··· 255 255 dput(dentry); 256 256 return ERR_PTR(-ENOMEM); 257 257 } 258 - dtmp = lookup_positive_unlocked(name, dentry, strlen(name)); 258 + dtmp = lookup_noperm_positive_unlocked(&QSTR(name), dentry); 259 259 dput(dentry); 260 260 kfree(name); 261 261 if (IS_ERR(dtmp))
+52 -35
fs/namei.c
··· 2834 2834 } 2835 2835 EXPORT_SYMBOL(vfs_path_lookup); 2836 2836 2837 - static int lookup_one_common(struct mnt_idmap *idmap, 2838 - const char *name, struct dentry *base, int len, 2839 - struct qstr *this) 2837 + static int lookup_noperm_common(const char *name, struct dentry *base, 2838 + int len, 2839 + struct qstr *this) 2840 2840 { 2841 2841 this->name = name; 2842 2842 this->len = len; ··· 2861 2861 if (err < 0) 2862 2862 return err; 2863 2863 } 2864 + return 0; 2865 + } 2864 2866 2867 + static int lookup_one_common(struct mnt_idmap *idmap, 2868 + const char *name, struct dentry *base, int len, 2869 + struct qstr *this) { 2870 + int err; 2871 + err = lookup_noperm_common(name, base, len, this); 2872 + if (err < 0) 2873 + return err; 2865 2874 return inode_permission(idmap, base->d_inode, MAY_EXEC); 2866 2875 } 2867 2876 2868 2877 /** 2869 - * try_lookup_one_len - filesystem helper to lookup single pathname component 2870 - * @name: pathname component to lookup 2878 + * try_lookup_noperm - filesystem helper to lookup single pathname component 2879 + * @name: qstr storing pathname component to lookup 2871 2880 * @base: base directory to lookup from 2872 - * @len: maximum length @len should be interpreted to 2873 2881 * 2874 2882 * Look up a dentry by name in the dcache, returning NULL if it does not 2875 2883 * currently exist. The function does not try to create a dentry. 2876 2884 * 2877 2885 * Note that this routine is purely a helper for filesystem usage and should 2878 - * not be called by generic code. 2886 + * not be called by generic code. It does no permission checking. 2879 2887 * 2880 2888 * No locks need be held - only a counted reference to @base is needed. 2881 2889 * 2882 2890 */ 2883 - struct dentry *try_lookup_one_len(const char *name, struct dentry *base, int len) 2891 + struct dentry *try_lookup_noperm(struct qstr *name, struct dentry *base) 2884 2892 { 2885 2893 struct qstr this; 2886 2894 int err; 2887 2895 2888 - err = lookup_one_common(&nop_mnt_idmap, name, base, len, &this); 2896 + err = lookup_noperm_common(name->name, base, name->len, &this); 2889 2897 if (err) 2890 2898 return ERR_PTR(err); 2891 2899 2892 - return lookup_dcache(&this, base, 0); 2900 + name->hash = this.hash; 2901 + return lookup_dcache(name, base, 0); 2893 2902 } 2894 - EXPORT_SYMBOL(try_lookup_one_len); 2903 + EXPORT_SYMBOL(try_lookup_noperm); 2895 2904 2896 2905 /** 2897 - * lookup_one_len - filesystem helper to lookup single pathname component 2898 - * @name: pathname component to lookup 2906 + * lookup_noperm - filesystem helper to lookup single pathname component 2907 + * @name: qstr storing pathname component to lookup 2899 2908 * @base: base directory to lookup from 2900 - * @len: maximum length @len should be interpreted to 2901 2909 * 2902 2910 * Note that this routine is purely a helper for filesystem usage and should 2903 - * not be called by generic code. 2911 + * not be called by generic code. It does no permission checking. 2904 2912 * 2905 2913 * The caller must hold base->i_mutex. 2906 2914 */ 2907 - struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) 2915 + struct dentry *lookup_noperm(struct qstr *name, struct dentry *base) 2908 2916 { 2909 2917 struct dentry *dentry; 2910 2918 struct qstr this; ··· 2920 2912 2921 2913 WARN_ON_ONCE(!inode_is_locked(base->d_inode)); 2922 2914 2923 - err = lookup_one_common(&nop_mnt_idmap, name, base, len, &this); 2915 + err = lookup_noperm_common(name->name, base, name->len, &this); 2924 2916 if (err) 2925 2917 return ERR_PTR(err); 2926 2918 2927 2919 dentry = lookup_dcache(&this, base, 0); 2928 2920 return dentry ? dentry : __lookup_slow(&this, base, 0); 2929 2921 } 2930 - EXPORT_SYMBOL(lookup_one_len); 2922 + EXPORT_SYMBOL(lookup_noperm); 2931 2923 2932 2924 /** 2933 2925 * lookup_one - lookup single pathname component ··· 2965 2957 * 2966 2958 * This can be used for in-kernel filesystem clients such as file servers. 2967 2959 * 2968 - * Unlike lookup_one_len, it should be called without the parent 2960 + * Unlike lookup_one, it should be called without the parent 2969 2961 * i_rwsem held, and will take the i_rwsem itself if necessary. 2970 2962 */ 2971 2963 struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap, ··· 3018 3010 EXPORT_SYMBOL(lookup_one_positive_unlocked); 3019 3011 3020 3012 /** 3021 - * lookup_one_len_unlocked - filesystem helper to lookup single pathname component 3013 + * lookup_noperm_unlocked - filesystem helper to lookup single pathname component 3022 3014 * @name: pathname component to lookup 3023 3015 * @base: base directory to lookup from 3024 - * @len: maximum length @len should be interpreted to 3025 3016 * 3026 3017 * Note that this routine is purely a helper for filesystem usage and should 3027 - * not be called by generic code. 3018 + * not be called by generic code. It does no permission checking. 3028 3019 * 3029 - * Unlike lookup_one_len, it should be called without the parent 3030 - * i_mutex held, and will take the i_mutex itself if necessary. 3020 + * Unlike lookup_noperm, it should be called without the parent 3021 + * i_rwsem held, and will take the i_rwsem itself if necessary. 3031 3022 */ 3032 - struct dentry *lookup_one_len_unlocked(const char *name, 3033 - struct dentry *base, int len) 3023 + struct dentry *lookup_noperm_unlocked(struct qstr *name, struct dentry *base) 3034 3024 { 3035 - return lookup_one_unlocked(&nop_mnt_idmap, &QSTR_LEN(name, len), base); 3025 + struct dentry *ret; 3026 + 3027 + ret = try_lookup_noperm(name, base); 3028 + if (!ret) 3029 + ret = lookup_slow(name, base, 0); 3030 + return ret; 3036 3031 } 3037 - EXPORT_SYMBOL(lookup_one_len_unlocked); 3032 + EXPORT_SYMBOL(lookup_noperm_unlocked); 3038 3033 3039 3034 /* 3040 - * Like lookup_one_len_unlocked(), except that it yields ERR_PTR(-ENOENT) 3035 + * Like lookup_noperm_unlocked(), except that it yields ERR_PTR(-ENOENT) 3041 3036 * on negatives. Returns known positive or ERR_PTR(); that's what 3042 3037 * most of the users want. Note that pinned negative with unlocked parent 3043 - * _can_ become positive at any time, so callers of lookup_one_len_unlocked() 3038 + * _can_ become positive at any time, so callers of lookup_noperm_unlocked() 3044 3039 * need to be very careful; pinned positives have ->d_inode stable, so 3045 3040 * this one avoids such problems. 3046 3041 */ 3047 - struct dentry *lookup_positive_unlocked(const char *name, 3048 - struct dentry *base, int len) 3042 + struct dentry *lookup_noperm_positive_unlocked(struct qstr *name, 3043 + struct dentry *base) 3049 3044 { 3050 - return lookup_one_positive_unlocked(&nop_mnt_idmap, 3051 - &QSTR_LEN(name, len), base); 3045 + struct dentry *ret; 3046 + 3047 + ret = lookup_noperm_unlocked(name, base); 3048 + if (!IS_ERR(ret) && d_flags_negative(smp_load_acquire(&ret->d_flags))) { 3049 + dput(ret); 3050 + ret = ERR_PTR(-ENOENT); 3051 + } 3052 + return ret; 3052 3053 } 3053 - EXPORT_SYMBOL(lookup_positive_unlocked); 3054 + EXPORT_SYMBOL(lookup_noperm_positive_unlocked); 3054 3055 3055 3056 #ifdef CONFIG_UNIX98_PTYS 3056 3057 int path_pts(struct path *path)
+5 -6
fs/nfs/unlink.c
··· 464 464 465 465 sdentry = NULL; 466 466 do { 467 - int slen; 468 467 dput(sdentry); 469 468 sillycounter++; 470 - slen = scnprintf(silly, sizeof(silly), 471 - SILLYNAME_PREFIX "%0*llx%0*x", 472 - SILLYNAME_FILEID_LEN, fileid, 473 - SILLYNAME_COUNTER_LEN, sillycounter); 469 + scnprintf(silly, sizeof(silly), 470 + SILLYNAME_PREFIX "%0*llx%0*x", 471 + SILLYNAME_FILEID_LEN, fileid, 472 + SILLYNAME_COUNTER_LEN, sillycounter); 474 473 475 474 dfprintk(VFS, "NFS: trying to rename %pd to %s\n", 476 475 dentry, silly); 477 476 478 - sdentry = lookup_one_len(silly, dentry->d_parent, slen); 477 + sdentry = lookup_noperm(&QSTR(silly), dentry->d_parent); 479 478 /* 480 479 * N.B. Better to return EBUSY here ... it could be 481 480 * dangerous to delete the file while it's in use.
+2 -4
fs/overlayfs/export.c
··· 385 385 */ 386 386 take_dentry_name_snapshot(&name, real); 387 387 /* 388 - * No idmap handling here: it's an internal lookup. Could skip 389 - * permission checking altogether, but for now just use non-idmap 390 - * transformed ids. 388 + * No idmap handling here: it's an internal lookup. 391 389 */ 392 - this = lookup_one_len(name.name.name, connected, name.name.len); 390 + this = lookup_noperm(&name.name, connected); 393 391 release_dentry_name_snapshot(&name); 394 392 err = PTR_ERR(this); 395 393 if (IS_ERR(this)) {
+1 -1
fs/overlayfs/namei.c
··· 757 757 if (err) 758 758 return ERR_PTR(err); 759 759 760 - index = lookup_positive_unlocked(name.name, ofs->workdir, name.len); 760 + index = lookup_noperm_positive_unlocked(&name, ofs->workdir); 761 761 kfree(name.name); 762 762 if (IS_ERR(index)) { 763 763 if (PTR_ERR(index) == -ENOENT)
+1 -1
fs/quota/dquot.c
··· 2560 2560 struct dentry *dentry; 2561 2561 int error; 2562 2562 2563 - dentry = lookup_positive_unlocked(qf_name, sb->s_root, strlen(qf_name)); 2563 + dentry = lookup_noperm_positive_unlocked(&QSTR(qf_name), sb->s_root); 2564 2564 if (IS_ERR(dentry)) 2565 2565 return PTR_ERR(dentry); 2566 2566
+3 -2
fs/smb/client/cached_dir.c
··· 109 109 while (*s && *s != sep) 110 110 s++; 111 111 112 - child = lookup_positive_unlocked(p, dentry, s - p); 112 + child = lookup_noperm_positive_unlocked(&QSTR_LEN(p, s - p), 113 + dentry); 113 114 dput(dentry); 114 115 dentry = child; 115 116 } while (!IS_ERR(dentry)); ··· 208 207 spin_unlock(&cfids->cfid_list_lock); 209 208 210 209 /* 211 - * Skip any prefix paths in @path as lookup_positive_unlocked() ends up 210 + * Skip any prefix paths in @path as lookup_noperm_positive_unlocked() ends up 212 211 * calling ->lookup() which already adds those through 213 212 * build_path_from_dentry(). Also, do it earlier as we might reconnect 214 213 * below when trying to send compounded request and then potentially
+2 -1
fs/smb/client/cifsfs.c
··· 929 929 while (*s && *s != sep) 930 930 s++; 931 931 932 - child = lookup_positive_unlocked(p, dentry, s - p); 932 + child = lookup_noperm_positive_unlocked(&QSTR_LEN(p, s - p), 933 + dentry); 933 934 dput(dentry); 934 935 dentry = child; 935 936 } while (!IS_ERR(dentry));
+1 -1
fs/tracefs/inode.c
··· 555 555 if (unlikely(IS_DEADDIR(d_inode(parent)))) 556 556 dentry = ERR_PTR(-ENOENT); 557 557 else 558 - dentry = lookup_one_len(name, parent, strlen(name)); 558 + dentry = lookup_noperm(&QSTR(name), parent); 559 559 if (!IS_ERR(dentry) && d_inode(dentry)) { 560 560 dput(dentry); 561 561 dentry = ERR_PTR(-EEXIST);
+1 -2
fs/xfs/scrub/orphanage.c
··· 153 153 154 154 /* Try to find the orphanage directory. */ 155 155 inode_lock_nested(root_inode, I_MUTEX_PARENT); 156 - orphanage_dentry = lookup_one_len(ORPHANAGE, root_dentry, 157 - strlen(ORPHANAGE)); 156 + orphanage_dentry = lookup_noperm(&QSTR(ORPHANAGE), root_dentry); 158 157 if (IS_ERR(orphanage_dentry)) { 159 158 error = PTR_ERR(orphanage_dentry); 160 159 goto out_unlock_root;
+4 -4
include/linux/namei.h
··· 69 69 int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, 70 70 unsigned int, struct path *); 71 71 72 - extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); 73 - extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 74 - extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); 75 - extern struct dentry *lookup_positive_unlocked(const char *, struct dentry *, int); 72 + extern struct dentry *try_lookup_noperm(struct qstr *, struct dentry *); 73 + extern struct dentry *lookup_noperm(struct qstr *, struct dentry *); 74 + extern struct dentry *lookup_noperm_unlocked(struct qstr *, struct dentry *); 75 + extern struct dentry *lookup_noperm_positive_unlocked(struct qstr *, struct dentry *); 76 76 struct dentry *lookup_one(struct mnt_idmap *, struct qstr *, struct dentry *); 77 77 struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap, 78 78 struct qstr *name, struct dentry *base);
+2 -3
ipc/mqueue.c
··· 913 913 914 914 ro = mnt_want_write(mnt); /* we'll drop it in any case */ 915 915 inode_lock(d_inode(root)); 916 - path.dentry = lookup_one_len(name->name, root, strlen(name->name)); 916 + path.dentry = lookup_noperm(&QSTR(name->name), root); 917 917 if (IS_ERR(path.dentry)) { 918 918 error = PTR_ERR(path.dentry); 919 919 goto out_putfd; ··· 969 969 if (err) 970 970 goto out_name; 971 971 inode_lock_nested(d_inode(mnt->mnt_root), I_MUTEX_PARENT); 972 - dentry = lookup_one_len(name->name, mnt->mnt_root, 973 - strlen(name->name)); 972 + dentry = lookup_noperm(&QSTR(name->name), mnt->mnt_root); 974 973 if (IS_ERR(dentry)) { 975 974 err = PTR_ERR(dentry); 976 975 goto out_unlock;
+1 -1
kernel/bpf/inode.c
··· 421 421 int ret; 422 422 423 423 inode_lock(parent->d_inode); 424 - dentry = lookup_one_len(name, parent, strlen(name)); 424 + dentry = lookup_noperm(&QSTR(name), parent); 425 425 if (IS_ERR(dentry)) { 426 426 inode_unlock(parent->d_inode); 427 427 return PTR_ERR(dentry);
+2 -2
security/apparmor/apparmorfs.c
··· 283 283 dir = d_inode(parent); 284 284 285 285 inode_lock(dir); 286 - dentry = lookup_one_len(name, parent, strlen(name)); 286 + dentry = lookup_noperm(&QSTR(name), parent); 287 287 if (IS_ERR(dentry)) { 288 288 error = PTR_ERR(dentry); 289 289 goto fail_lock; ··· 2551 2551 return error; 2552 2552 2553 2553 inode_lock(d_inode(parent)); 2554 - dentry = lookup_one_len(NULL_FILE_NAME, parent, strlen(NULL_FILE_NAME)); 2554 + dentry = lookup_noperm(&QSTR(NULL_FILE_NAME), parent); 2555 2555 if (IS_ERR(dentry)) { 2556 2556 error = PTR_ERR(dentry); 2557 2557 goto out;
+1 -1
security/inode.c
··· 128 128 dir = d_inode(parent); 129 129 130 130 inode_lock(dir); 131 - dentry = lookup_one_len(name, parent, strlen(name)); 131 + dentry = lookup_noperm(&QSTR(name), parent); 132 132 if (IS_ERR(dentry)) 133 133 goto out; 134 134