summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2020-11-20 17:14:26 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-21 14:52:48 +0200
commit23f55649921b78ddc3b24a443e755e546a574288 (patch)
tree8f936bd6f723ae0608c60d913a22886f9a71590b /kernel
parent9080557c56cd673941675f38805356f7f72949fa (diff)
downloadlinux-stable-23f55649921b78ddc3b24a443e755e546a574288.tar.gz
linux-stable-23f55649921b78ddc3b24a443e755e546a574288.tar.bz2
linux-stable-23f55649921b78ddc3b24a443e755e546a574288.zip
file: Replace fcheck_files with files_lookup_fd_rcu
[ Upstream commit f36c2943274199cb8aef32ac96531ffb7c4b43d0 ] This change renames fcheck_files to files_lookup_fd_rcu. All of the remaining callers take the rcu_read_lock before calling this function so the _rcu suffix is appropriate. This change also tightens up the debug check to verify that all callers hold the rcu_read_lock. All callers that used to call files_check with the files->file_lock held have now been changed to call files_lookup_fd_locked. This change of name has helped remind me of which locks and which guarantees are in place helping me to catch bugs later in the patchset. The need for better names became apparent in the last round of discussion of this set of changes[1]. [1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com Link: https://lkml.kernel.org/r/20201120231441.29911-9-ebiederm@xmission.com Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/task_iter.c2
-rw-r--r--kernel/kcmp.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
index f3d3a562a802..762b4d7c3779 100644
--- a/kernel/bpf/task_iter.c
+++ b/kernel/bpf/task_iter.c
@@ -185,7 +185,7 @@ again:
for (; curr_fd < max_fds; curr_fd++) {
struct file *f;
- f = fcheck_files(curr_files, curr_fd);
+ f = files_lookup_fd_rcu(curr_files, curr_fd);
if (!f)
continue;
if (!get_file_rcu(f))
diff --git a/kernel/kcmp.c b/kernel/kcmp.c
index bd6f9edf98fd..5b2435e03047 100644
--- a/kernel/kcmp.c
+++ b/kernel/kcmp.c
@@ -67,7 +67,7 @@ get_file_raw_ptr(struct task_struct *task, unsigned int idx)
rcu_read_lock();
if (task->files)
- file = fcheck_files(task->files, idx);
+ file = files_lookup_fd_rcu(task->files, idx);
rcu_read_unlock();
task_unlock(task);