Skip to contentSkip to conversation

proc: do mmput ASAP for /proc/*/map_files

PATCH New Alexey Dobriyan 1 participant 1 message Mar 9, 2018 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: do mmput ASAP for /proc/*/map_files

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

---

 fs/proc/base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/base.c +1 -1
@@ -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);