Hi Xie, url: https://github.com/0day-ci/linux/commits/Xie-Yongji/Introduce-VDUSE-vDPA-Device-in-Userspace/20210223-200222 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: i386-randconfig-m021-20210223 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: drivers/vhost/vdpa.c:660 vhost_vdpa_va_map() warn: inconsistent returns '&dev->mm->mmap_lock'. vim +660 drivers/vhost/vdpa.c d8433d0f11798a Xie Yongji 2021-02-23 614 static int vhost_vdpa_va_map(struct vhost_vdpa *v, d8433d0f11798a Xie Yongji 2021-02-23 615 u64 iova, u64 size, u64 uaddr, u32 perm) d8433d0f11798a Xie Yongji 2021-02-23 616 { d8433d0f11798a Xie Yongji 2021-02-23 617 struct vhost_dev *dev = &v->vdev; d8433d0f11798a Xie Yongji 2021-02-23 618 u64 offset, map_size, map_iova = iova; d8433d0f11798a Xie Yongji 2021-02-23 619 struct vdpa_map_file *map_file; d8433d0f11798a Xie Yongji 2021-02-23 620 struct vm_area_struct *vma; d8433d0f11798a Xie Yongji 2021-02-23 621 int ret; d8433d0f11798a Xie Yongji 2021-02-23 622 d8433d0f11798a Xie Yongji 2021-02-23 623 mmap_read_lock(dev->mm); d8433d0f11798a Xie Yongji 2021-02-23 624 d8433d0f11798a Xie Yongji 2021-02-23 625 while (size) { d8433d0f11798a Xie Yongji 2021-02-23 626 vma = find_vma(dev->mm, uaddr); d8433d0f11798a Xie Yongji 2021-02-23 627 if (!vma) { d8433d0f11798a Xie Yongji 2021-02-23 628 ret = -EINVAL; d8433d0f11798a Xie Yongji 2021-02-23 629 goto err; d8433d0f11798a Xie Yongji 2021-02-23 630 } d8433d0f11798a Xie Yongji 2021-02-23 631 map_size = min(size, vma->vm_end - uaddr); d8433d0f11798a Xie Yongji 2021-02-23 632 offset = (vma->vm_pgoff << PAGE_SHIFT) + uaddr - vma->vm_start; d8433d0f11798a Xie Yongji 2021-02-23 633 map_file = kzalloc(sizeof(*map_file), GFP_KERNEL); d8433d0f11798a Xie Yongji 2021-02-23 634 if (!map_file) { d8433d0f11798a Xie Yongji 2021-02-23 635 ret = -ENOMEM; d8433d0f11798a Xie Yongji 2021-02-23 636 goto err; d8433d0f11798a Xie Yongji 2021-02-23 637 } d8433d0f11798a Xie Yongji 2021-02-23 638 if (vma->vm_file && (vma->vm_flags & VM_SHARED) && d8433d0f11798a Xie Yongji 2021-02-23 639 !(vma->vm_flags & (VM_IO | VM_PFNMAP))) { d8433d0f11798a Xie Yongji 2021-02-23 640 map_file->file = get_file(vma->vm_file); d8433d0f11798a Xie Yongji 2021-02-23 641 map_file->offset = offset; d8433d0f11798a Xie Yongji 2021-02-23 642 } d8433d0f11798a Xie Yongji 2021-02-23 643 ret = vhost_vdpa_map(v, map_iova, map_size, uaddr, d8433d0f11798a Xie Yongji 2021-02-23 644 perm, map_file); d8433d0f11798a Xie Yongji 2021-02-23 645 if (ret) { d8433d0f11798a Xie Yongji 2021-02-23 646 if (map_file->file) d8433d0f11798a Xie Yongji 2021-02-23 647 fput(map_file->file); d8433d0f11798a Xie Yongji 2021-02-23 648 kfree(map_file); d8433d0f11798a Xie Yongji 2021-02-23 649 goto err; d8433d0f11798a Xie Yongji 2021-02-23 650 } d8433d0f11798a Xie Yongji 2021-02-23 651 size -= map_size; d8433d0f11798a Xie Yongji 2021-02-23 652 uaddr += map_size; d8433d0f11798a Xie Yongji 2021-02-23 653 map_iova += map_size; d8433d0f11798a Xie Yongji 2021-02-23 654 } d8433d0f11798a Xie Yongji 2021-02-23 655 mmap_read_unlock(dev->mm); ^^^^^^^^^^^^^^^^^^^^^^^^^ The success path unlocks. d8433d0f11798a Xie Yongji 2021-02-23 656 d8433d0f11798a Xie Yongji 2021-02-23 657 return 0; d8433d0f11798a Xie Yongji 2021-02-23 658 err: d8433d0f11798a Xie Yongji 2021-02-23 659 vhost_vdpa_unmap(v, iova, map_iova - iova); d8433d0f11798a Xie Yongji 2021-02-23 @660 return ret; The error path doesn't seem to unlock. I did look at vhost_vdpa_unmap() briefly, but I didn't see any reason that we don't need to unlock but I may have missed it. The point of sending these bug reports as soon as possible is that hopefully you know the answer off the top of your head. :) d8433d0f11798a Xie Yongji 2021-02-23 661 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org