Re: [tip: perf/urgent] perf/aux: Fix tracking of auxiliary trace buffer allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"tip-bot2 for Thomas Richter" <tip-bot2@xxxxxxxxxxxxx> writes:

>  		/* now it's safe to free the pages */
> -		atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm);
> -		atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);
> +		if (!rb->aux_mmap_locked)
> +			atomic_long_sub(rb->aux_nr_pages, &mmap_user->locked_vm);
> +		else
> +			atomic64_sub(rb->aux_mmap_locked, &vma->vm_mm->pinned_vm);

This only works correctly when rb->aux_mmap_locked is either equal to
rb->aux_nr_pages or zero. Otherwise, it leaks

  rb->aux_nr_pages - rb->aux_mmap_locked

in the locked_vm permanently.

Regards,
--
Alex



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux