Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1347066 > unrolled thread
| Started by | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| First post | 2016-03-01 23:20 +0100 |
| Last post | 2016-03-02 17:40 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] dax: check return value of dax_radix_entry() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-03-01 23:20 +0100
Re: [PATCH] dax: check return value of dax_radix_entry() Matthew Wilcox <willy@linux.intel.com> - 2016-03-02 15:10 +0100
Re: [PATCH] dax: check return value of dax_radix_entry() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-03-02 17:40 +0100
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-03-01 23:20 +0100 |
| Subject | [PATCH] dax: check return value of dax_radix_entry() |
| Message-ID | <r80O6-6VE-7@gated-at.bofh.it> |
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 pass it up the stack if it is an
error.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
fs/dax.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/dax.c b/fs/dax.c
index 7111724..5a587dc 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1056,6 +1056,7 @@ EXPORT_SYMBOL_GPL(dax_pmd_fault);
int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct file *file = vma->vm_file;
+ int error;
/*
* We pass NO_SECTOR to dax_radix_entry() because we expect that a
@@ -1065,7 +1066,11 @@ int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
* saves us from having to make a call to get_block() here to look
* up the sector.
*/
- dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true);
+ error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false,
+ true);
+ if (error)
+ return error;
+
return VM_FAULT_NOPAGE;
}
EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
--
2.5.0
[toc] | [next] | [standalone]
| From | Matthew Wilcox <willy@linux.intel.com> |
|---|---|
| Date | 2016-03-02 15:10 +0100 |
| Message-ID | <r8fDs-gr-25@gated-at.bofh.it> |
| In reply to | #1347066 |
On Tue, Mar 01, 2016 at 03:15:08PM -0700, Ross Zwisler wrote: > 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 pass it up the stack if it is an > error. > */ > - dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true); > + error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, > + true); > + if (error) > + return error; > + > return VM_FAULT_NOPAGE; You can't return an errno from here. if (error) return VM_FAULT_SIGBUS; is better. For full points, if (error == -ENOMEM) return VM_FAULT_OOM; if (error) return VM_FAULT_SIGBUS; return VM_FAULT_NOPAGE;
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-03-02 17:40 +0100 |
| Message-ID | <r8hYC-1Lj-25@gated-at.bofh.it> |
| In reply to | #1348058 |
On Wed, Mar 02, 2016 at 09:09:47AM -0500, Matthew Wilcox wrote: > On Tue, Mar 01, 2016 at 03:15:08PM -0700, Ross Zwisler wrote: > > 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 pass it up the stack if it is an > > error. > > > */ > > - dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true); > > + error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, > > + true); > > + if (error) > > + return error; > > + > > return VM_FAULT_NOPAGE; > > You can't return an errno from here. > > if (error) > return VM_FAULT_SIGBUS; > > is better. For full points, > > if (error == -ENOMEM) > return VM_FAULT_OOM; > if (error) > return VM_FAULT_SIGBUS; > return VM_FAULT_NOPAGE; Ah, thank you for catching that.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web