diff options
author | Ross Zwisler <ross.zwisler@linux.intel.com> | 2016-03-09 17:08:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-09 18:43:42 -0500 |
commit | 30f471fd88e0304bee2c17ef1a4651e705870817 (patch) | |
tree | 0fe15e01cee010e6b4461f0da76092f68d1bba32 /fs | |
parent | 566e8dfd88d9e0d12873ca69c26e82c0af8479d8 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dax.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1056,6 +1056,7 @@ EXPORT_SYMBOL_GPL(dax_pmd_fault); | |||
1056 | int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 1056 | int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
1057 | { | 1057 | { |
1058 | struct file *file = vma->vm_file; | 1058 | struct file *file = vma->vm_file; |
1059 | int error; | ||
1059 | 1060 | ||
1060 | /* | 1061 | /* |
1061 | * We pass NO_SECTOR to dax_radix_entry() because we expect that a | 1062 | * 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) | |||
1065 | * saves us from having to make a call to get_block() here to look | 1066 | * saves us from having to make a call to get_block() here to look |
1066 | * up the sector. | 1067 | * up the sector. |
1067 | */ | 1068 | */ |
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; | ||
1069 | return VM_FAULT_NOPAGE; | 1076 | return VM_FAULT_NOPAGE; |
1070 | } | 1077 | } |
1071 | EXPORT_SYMBOL_GPL(dax_pfn_mkwrite); | 1078 | EXPORT_SYMBOL_GPL(dax_pfn_mkwrite); |