Skip to content

Commit 1998919

Browse files
KAGA-KOKOgregkh
authored andcommitted
perf/core: Preserve AUX buffer allocation failure result
commit 54473e0 upstream. A recent overhaul sets the return value to 0 unconditionally after the allocations, which causes reference count leaks and corrupts the user->vm accounting. Preserve the AUX buffer allocation failure return value, so that the subsequent code works correctly. Fixes: 0983593 ("perf/core: Lift event->mmap_mutex in perf_mmap()") Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3b549da commit 1998919

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

kernel/events/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7052,15 +7052,14 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
70527052
perf_event_update_time(event);
70537053
perf_event_init_userpage(event);
70547054
perf_event_update_userpage(event);
7055+
ret = 0;
70557056
} else {
70567057
ret = rb_alloc_aux(rb, event, vma->vm_pgoff, nr_pages,
70577058
event->attr.aux_watermark, flags);
70587059
if (!ret)
70597060
rb->aux_mmap_locked = extra;
70607061
}
70617062

7062-
ret = 0;
7063-
70647063
unlock:
70657064
if (!ret) {
70667065
atomic_long_add(user_extra, &user->locked_vm);

0 commit comments

Comments
 (0)