[Ocfs2-commits] mfasheh commits r1279 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Jul 15 20:27:47 CDT 2004


Author: mfasheh
Date: 2004-07-15 19:27:45 -0500 (Thu, 15 Jul 2004)
New Revision: 1279

Modified:
   trunk/src/inode.c
Log:
* fix a bug in readpage where we weren't zeroing out past end of file.



Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-07-15 23:47:29 UTC (rev 1278)
+++ trunk/src/inode.c	2004-07-16 00:27:45 UTC (rev 1279)
@@ -1212,13 +1212,31 @@
 static int ocfs_readpage (struct file *file, struct page *page)
 {
 	int ret;
+	struct inode *inode = page->mapping->host;
+	unsigned int local;
+	void *buff;
 
 	LOG_SET_CONTEXT(READPAGE);
 
+	if (!inode)
+		BUG();
+
 	LOG_ENTRY_ARGS ("(0x%p, %lu)\n", file, (page ? page->index : 0));
 
 	ret = block_read_full_page (page, ocfs_get_block);
+	if (ret < 0)
+		goto bail;
 
+	/* because of our massive security hole. */
+	if (page->index == 
+	    (unsigned long) (inode->i_size >> PAGE_CACHE_SHIFT)) {
+		local = (inode->i_size & ~PAGE_CACHE_MASK);
+		buff = kmap(page);
+		memset(buff + local, 0, PAGE_CACHE_SIZE - local);
+		kunmap(page);
+	}
+
+bail:
 	LOG_EXIT_INT (ret);
 
 	LOG_CLEAR_CONTEXT();



More information about the Ocfs2-commits mailing list