fs: ext4: disable support for FALLOC_FL_PUNCH_HOLE
Woojung Min [Thu, 10 Nov 2016 05:48:18 +0000 (10:48 +0530)]
Disable support for the fallocate FALLOC_FL_PUNCH_HOLE to
prevent the race conditions.

CVE-2015-8839
ANDROID-28760453

Jira EASS-863

Bug 1797728

Change-Id: Iae76df73f811da4e8209d21dd0803b070c0db684
Reviewed-on: http://git-master/r/1209635
(cherry picked from commit 9704617c5412f4cde41270259331a9078b479915)
Reviewed-on: http://git-master/r/1213238
(cherry picked from commit 533c2cafdb20f630647b88ae443b580216ebfc34)
Reviewed-on: http://git-master/r/1230816
Signed-off-by: Vaibhav Shinde <vashinde@nvidia.com>
Reviewed-on: http://git-master/r/1250871
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dhiren Parmar <dparmar@nvidia.com>

fs/ext4/inode.c

index a284e6a..801e235 100644 (file)
@@ -3525,6 +3525,7 @@ int ext4_can_truncate(struct inode *inode)
 
 int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
 {
+#if 0
        struct super_block *sb = inode->i_sb;
        ext4_lblk_t first_block, stop_block;
        struct address_space *mapping = inode->i_mapping;
@@ -3648,6 +3649,12 @@ out_dio:
 out_mutex:
        mutex_unlock(&inode->i_mutex);
        return ret;
+#else
+       /*
+        *       * Disabled as per b/28760453
+        *               */
+       return -EOPNOTSUPP;
+#endif
 }
 
 int ext4_inode_attach_jinode(struct inode *inode)