Commit 5a14e91d authored by Jeff Moyer's avatar Jeff Moyer Committed by Dan Williams

dev-dax: check_vma: ratelimit dev_info-s

This is easily triggered from userspace, so let's ratelimit the
messages.
Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent b62cc6fd
...@@ -189,14 +189,16 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma, ...@@ -189,14 +189,16 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma,
/* prevent private mappings from being established */ /* prevent private mappings from being established */
if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) { if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) {
dev_info(dev, "%s: %s: fail, attempted private mapping\n", dev_info_ratelimited(dev,
"%s: %s: fail, attempted private mapping\n",
current->comm, func); current->comm, func);
return -EINVAL; return -EINVAL;
} }
mask = dax_region->align - 1; mask = dax_region->align - 1;
if (vma->vm_start & mask || vma->vm_end & mask) { if (vma->vm_start & mask || vma->vm_end & mask) {
dev_info(dev, "%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n", dev_info_ratelimited(dev,
"%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
current->comm, func, vma->vm_start, vma->vm_end, current->comm, func, vma->vm_start, vma->vm_end,
mask); mask);
return -EINVAL; return -EINVAL;
...@@ -204,13 +206,15 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma, ...@@ -204,13 +206,15 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma,
if ((dax_region->pfn_flags & (PFN_DEV|PFN_MAP)) == PFN_DEV if ((dax_region->pfn_flags & (PFN_DEV|PFN_MAP)) == PFN_DEV
&& (vma->vm_flags & VM_DONTCOPY) == 0) { && (vma->vm_flags & VM_DONTCOPY) == 0) {
dev_info(dev, "%s: %s: fail, dax range requires MADV_DONTFORK\n", dev_info_ratelimited(dev,
"%s: %s: fail, dax range requires MADV_DONTFORK\n",
current->comm, func); current->comm, func);
return -EINVAL; return -EINVAL;
} }
if (!vma_is_dax(vma)) { if (!vma_is_dax(vma)) {
dev_info(dev, "%s: %s: fail, vma is not DAX capable\n", dev_info_ratelimited(dev,
"%s: %s: fail, vma is not DAX capable\n",
current->comm, func); current->comm, func);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment