summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-04-18 12:04:36 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-04-18 12:08:42 +0200
commitf396c12ecfda1717e5f76d6b4ab11e4db232e60d (patch)
tree6a085b5e8ed3d29e884f6012f0aeaad178ba50eb
parentd46291bc2469b59250b0718ce7e596a6cc787f6c (diff)
kdbus: use rcu to access exe file in metadata
Commit 90f31d0ea888 ("mm: rcu-protected get_mm_exe_file()") removed mm->mmap_sem from mm->exe_file read side. Follow that change in the kdbus metadata code. Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Daniel Mack <daniel@zonque.org> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--ipc/kdbus/metadata.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ipc/kdbus/metadata.c b/ipc/kdbus/metadata.c
index 3adc6c2c2e76..0d846f8562b1 100644
--- a/ipc/kdbus/metadata.c
+++ b/ipc/kdbus/metadata.c
@@ -285,19 +285,21 @@ static void kdbus_meta_proc_collect_pid_comm(struct kdbus_meta_proc *mp)
static void kdbus_meta_proc_collect_exe(struct kdbus_meta_proc *mp)
{
struct mm_struct *mm;
+ struct file *exe_file;
mm = get_task_mm(current);
if (!mm)
return;
- down_read(&mm->mmap_sem);
- if (mm->exe_file) {
- mp->exe_path = mm->exe_file->f_path;
+ rcu_read_lock();
+ exe_file = rcu_dereference(mm->exe_file);
+ if (exe_file) {
+ mp->exe_path = exe_file->f_path;
path_get(&mp->exe_path);
get_fs_root(current->fs, &mp->root_path);
mp->valid |= KDBUS_ATTACH_EXE;
}
- up_read(&mm->mmap_sem);
+ rcu_read_unlock();
mmput(mm);
}