Skip to content

Commit fe079a5

Browse files
Alexey Dobriyantorvalds
authored andcommitted
proc: do mmput ASAP for /proc/*/map_files
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 <adobriyan@gmail.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 58c501a commit fe079a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/proc/base.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,7 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
22112211
}
22122212
}
22132213
up_read(&mm->mmap_sem);
2214+
mmput(mm);
22142215

22152216
for (i = 0; i < nr_files; i++) {
22162217
char buf[4 * sizeof(long) + 2]; /* max: %lx-%lx\0 */
@@ -2228,7 +2229,6 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
22282229
}
22292230
if (fa)
22302231
flex_array_free(fa);
2231-
mmput(mm);
22322232

22332233
out_put_task:
22342234
put_task_struct(task);

0 commit comments

Comments
 (0)