A recent fix moved the build ID evaluation past the mmput() of the success path but kept the error goto unchanged, which ends up in doing another quert_vma_teardown() and another mmput(). Change the goto so it jumps past the mmput() and only puts the file and the buffer. Fixes: b5cbacd7f86f ("procfs: avoid fetching build ID while holding VMA lock") Reported-by: syzbot+237b5b985b78c1da9600@syzkaller.appspotmail.com Signed-off-by: Thomas Gleixner Closes: https://lore.kernel.org/698aaf3c.050a0220.3b3015.0088.GAE@google.com/T/#u --- fs/proc/task_mmu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -780,7 +780,7 @@ static int do_procmap_query(struct mm_st } else { if (karg.build_id_size < build_id_sz) { err = -ENAMETOOLONG; - goto out; + goto out_file; } karg.build_id_size = build_id_sz; } @@ -808,6 +808,8 @@ static int do_procmap_query(struct mm_st out: query_vma_teardown(&lock_ctx); mmput(mm); + +out_file: if (vm_file) fput(vm_file); kfree(name_buf);