aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2007-08-31 02:56:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 04:42:23 -0400
commit2aeb3db17fc33443d21b11d7121c5627d55717c6 (patch)
tree93cdb60d5e48d1f92a974b905ddcf7ee8072dbeb
parent85787a2bea516b76a013eea7f5f3fad12c5a6417 (diff)
eCryptfs: fix possible fault in ecryptfs_sync_page
This will avoid a possible fault in ecryptfs_sync_page(). In the function, eCryptfs calls sync_page() method of a lower filesystem without checking its existence. However, there are many filesystems that don't have this method including network filesystems such as NFS, AFS, and so forth. They may fail when an eCryptfs page is waiting for lock. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Acked-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ecryptfs/mmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index e4ab7bc14efe..fd3f94d4a668 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -834,7 +834,8 @@ static void ecryptfs_sync_page(struct page *page)
834 ecryptfs_printk(KERN_DEBUG, "find_lock_page failed\n"); 834 ecryptfs_printk(KERN_DEBUG, "find_lock_page failed\n");
835 return; 835 return;
836 } 836 }
837 lower_page->mapping->a_ops->sync_page(lower_page); 837 if (lower_page->mapping->a_ops->sync_page)
838 lower_page->mapping->a_ops->sync_page(lower_page);
838 ecryptfs_printk(KERN_DEBUG, "Unlocking page with index = [0x%.16x]\n", 839 ecryptfs_printk(KERN_DEBUG, "Unlocking page with index = [0x%.16x]\n",
839 lower_page->index); 840 lower_page->index);
840 unlock_page(lower_page); 841 unlock_page(lower_page);