Skip to content

Commit

Permalink
proc: do mmput ASAP for /proc/*/map_files
Browse files Browse the repository at this point in the history
mm_struct is not needed while printing as all the data was already
extracted.

Link: http://lkml.kernel.org/r/20180309223120.GC3843@avx2
Signed-off-by: Alexey Dobriyan <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
(cherry picked from commit fbb8a8d973147842fc4a0b2e691f7afbca0d9b6a)
(cherry picked from commit 5b61645c63a6fa31644f966db5b7888e5a27a0bc)
(cherry picked from commit 18d7bee7ed301d563d7f922af492a5aa162ccc94)
(cherry picked from commit 6392f9c911fbd6ff6643280d01f832d82267fba4)
(cherry picked from commit 59d6046e40b9ff451b258594ea636b3ce01c20fb)
(cherry picked from commit e44ec91bab8e85dc0cca17eb49c332030a2fc6cc)
(cherry picked from commit ad4724d5d7ee54cfd6994f3b160c495514583952)
(cherry picked from commit 376ab4f3aa76365f719b7962dfdfc6180da6614a)
  • Loading branch information
Alexey Dobriyan authored and PainKiller3 committed Apr 8, 2021
1 parent b5cc1c8 commit 208f10b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2427,6 +2427,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
}
}
up_read(&mm->mmap_sem);
mmput(mm);

for (i = 0; i < nr_files; i++) {
p = flex_array_get(fa, i);
Expand All @@ -2440,7 +2441,6 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
}
if (fa)
flex_array_free(fa);
mmput(mm);

out_put_task:
put_task_struct(task);
Expand Down

0 comments on commit 208f10b

Please sign in to comment.