Skip to content

Commit 30f471f

Browse files
Ross Zwislertorvalds
authored andcommitted
dax: check return value of dax_radix_entry()
dax_pfn_mkwrite() previously wasn't checking the return value of the call to dax_radix_entry(), which was a mistake. Instead, capture this return value and return the appropriate VM_FAULT_ value. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: Dave Chinner <david@fromorbit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 566e8df commit 30f471f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/dax.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@ EXPORT_SYMBOL_GPL(dax_pmd_fault);
10561056
int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
10571057
{
10581058
struct file *file = vma->vm_file;
1059+
int error;
10591060

10601061
/*
10611062
* We pass NO_SECTOR to dax_radix_entry() because we expect that a
@@ -1065,7 +1066,13 @@ int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
10651066
* saves us from having to make a call to get_block() here to look
10661067
* up the sector.
10671068
*/
1068-
dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true);
1069+
error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false,
1070+
true);
1071+
1072+
if (error == -ENOMEM)
1073+
return VM_FAULT_OOM;
1074+
if (error)
1075+
return VM_FAULT_SIGBUS;
10691076
return VM_FAULT_NOPAGE;
10701077
}
10711078
EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);

0 commit comments

Comments
 (0)