fs/nfs/file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Add error handling for wait_on_bit_action() failures in the page
fault path. Return VM_FAULT_SIGBUS instead of proceeding with
folio operations when wait_on_bit_action() fails.
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
fs/nfs/file.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1bb646752e46..9e492391687b 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -590,6 +590,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
struct file *filp = vmf->vma->vm_file;
struct inode *inode = file_inode(filp);
unsigned pagelen;
+ int r;
vm_fault_t ret = VM_FAULT_NOPAGE;
struct address_space *mapping;
struct folio *folio = page_folio(vmf->page);
@@ -607,9 +608,13 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
goto out;
}
- wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
+ r = wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
nfs_wait_bit_killable,
TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
+ if (r) {
+ ret = VM_FAULT_SIGBUS;
+ goto out;
+ }
folio_lock(folio);
mapping = folio->mapping;
--
2.42.0.windows.2
> Add error handling for wait_on_bit_action() failures in the page
> fault path. Return VM_FAULT_SIGBUS instead of proceeding with
> folio operations when wait_on_bit_action() fails.
call failed?
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc5#n145
Regards,
Markus
© 2016 - 2026 Red Hat, Inc.