[PATCH] proc: do mmput ASAP for /proc/*/map_files

From: Alexey Dobriyan
Date: Fri Mar 09 2018 - 17:31:32 EST


mm_struct not needed while printing as all the data was already extracted.


Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
---

fs/proc/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2214,6 +2214,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++) {
char buf[4 * sizeof(long) + 2]; /* max: %lx-%lx\0 */
@@ -2231,7 +2232,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);