Skip to content

Commit 5a14e91

Browse files
JeffMoyerdjbw
authored andcommitted
dev-dax: check_vma: ratelimit dev_info-s
This is easily triggered from userspace, so let's ratelimit the messages. Signed-off-by: Jeff Moyer <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent b62cc6f commit 5a14e91

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/dax/device.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,28 +189,32 @@ static int check_vma(struct dev_dax *dev_dax, struct vm_area_struct *vma,
189189

190190
/* prevent private mappings from being established */
191191
if ((vma->vm_flags & VM_MAYSHARE) != VM_MAYSHARE) {
192-
dev_info(dev, "%s: %s: fail, attempted private mapping\n",
192+
dev_info_ratelimited(dev,
193+
"%s: %s: fail, attempted private mapping\n",
193194
current->comm, func);
194195
return -EINVAL;
195196
}
196197

197198
mask = dax_region->align - 1;
198199
if (vma->vm_start & mask || vma->vm_end & mask) {
199-
dev_info(dev, "%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
200+
dev_info_ratelimited(dev,
201+
"%s: %s: fail, unaligned vma (%#lx - %#lx, %#lx)\n",
200202
current->comm, func, vma->vm_start, vma->vm_end,
201203
mask);
202204
return -EINVAL;
203205
}
204206

205207
if ((dax_region->pfn_flags & (PFN_DEV|PFN_MAP)) == PFN_DEV
206208
&& (vma->vm_flags & VM_DONTCOPY) == 0) {
207-
dev_info(dev, "%s: %s: fail, dax range requires MADV_DONTFORK\n",
209+
dev_info_ratelimited(dev,
210+
"%s: %s: fail, dax range requires MADV_DONTFORK\n",
208211
current->comm, func);
209212
return -EINVAL;
210213
}
211214

212215
if (!vma_is_dax(vma)) {
213-
dev_info(dev, "%s: %s: fail, vma is not DAX capable\n",
216+
dev_info_ratelimited(dev,
217+
"%s: %s: fail, vma is not DAX capable\n",
214218
current->comm, func);
215219
return -EINVAL;
216220
}

0 commit comments

Comments
 (0)