From: Oleg Nesterov <oleg@xxxxxxxxxx> build_map_info() has a side effect like one need to perform mmput() when done with the mm. Add mmput() in free_map_info() so that user does not have to call it explicitly. Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxxxxxxx> --- kernel/events/uprobes.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 535fd39..1d439c7 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -704,6 +704,7 @@ struct map_info { static inline struct map_info *free_map_info(struct map_info *info) { struct map_info *next = info->next; + mmput(info->mm); kfree(info); return next; } @@ -773,8 +774,11 @@ static inline struct map_info *free_map_info(struct map_info *info) goto again; out: - while (prev) - prev = free_map_info(prev); + while (prev) { + info = prev; + prev = prev->next; + kfree(info); + } return curr; } @@ -824,7 +828,6 @@ static inline struct map_info *free_map_info(struct map_info *info) unlock: up_write(&mm->mmap_sem); free: - mmput(mm); info = free_map_info(info); } out: -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html