[PATCH 08/12] dax: Fix bogus fault return value on cow faults

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of cow fault when there is no page mapped at cow location, we
return VM_FAULT_LOCKED despite we don't return any page from the fault.
The code in do_cow_fault() carefully handled the case when no page was
actually returned so no harm was done but still this is a bug waiting to
happen.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/dax.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 4aa440f9305b..bf39f16e5390 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -680,7 +680,9 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
 		if (error)
 			goto unlock_page;
 		vmf->page = page;
-		return VM_FAULT_LOCKED;
+		if (page)
+			return VM_FAULT_LOCKED;
+		return 0;
 	}
 
 	/* Check we didn't race with a read fault installing a new page */
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux