linux-yocto/ipc
NeilBrown fa6fe07d15
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>
2025-04-08 11:24:36 +02:00
..
compat.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ipc_sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mq_sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
mqueue.c VFS: rename lookup_one_len family to lookup_noperm and remove permission check 2025-04-08 11:24:36 +02:00
msg.c ipc/msg: replace one-element array with flexible array member 2024-11-05 17:12:28 -08:00
msgutil.c ipc, msg: Use dedicated slab buckets for alloc_msg() 2024-07-03 12:24:20 +02:00
namespace.c ipc: fix memleak if msg_init_ns failed in create_ipc_ns 2024-11-05 17:12:33 -08:00
sem.c ipc/sem: use flexible array in 'struct sem_undo' 2023-08-18 10:18:51 -07:00
shm.c ipc/shm, mm: drop do_vma_munmap() 2024-09-03 21:15:52 -07:00
syscall.c y2038: remove CONFIG_64BIT_TIME 2019-11-15 14:38:27 +01:00
util.c ipc/util.c: complete the kernel-doc function descriptions 2025-01-24 22:47:27 -08:00
util.h sched.h: move pid helpers to pid.h 2023-12-20 19:26:31 -05:00