kernel/events/uprobes: use vma_lookup() in find_active_uprobe()
authorLiam Howlett <liam.howlett@oracle.com>
Tue, 29 Jun 2021 02:39:35 +0000 (19:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:51 +0000 (10:53 -0700)
Use vma_lookup() to find the VMA at a specific address.  As vma_lookup()
will return NULL if the address is not within any VMA, the start address
no longer needs to be validated.

Link: https://lkml.kernel.org/r/20210521174745.2219620-17-Liam.Howlett@Oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/events/uprobes.c

index 6addc97803198d5f80d7b77a8f65b8aaef53dd9d..907d4ee00cb2f29961476ba54ba18ea01d90d45f 100644 (file)
@@ -2046,8 +2046,8 @@ static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp)
        struct vm_area_struct *vma;
 
        mmap_read_lock(mm);
-       vma = find_vma(mm, bp_vaddr);
-       if (vma && vma->vm_start <= bp_vaddr) {
+       vma = vma_lookup(mm, bp_vaddr);
+       if (vma) {
                if (valid_vma(vma, false)) {
                        struct inode *inode = file_inode(vma->vm_file);
                        loff_t offset = vaddr_to_offset(vma, bp_vaddr);