lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  6 Apr 2015 22:35:01 -0700
From:	Davide Italiano <dccitaliano@...il.com>
To:	linux-ext4@...r.kernel.org
Cc:	Davide Italiano <dccitaliano@...il.com>
Subject: [PATCH] ext4: Remove redundant check under lock scope

ext4_zero_range() and ext4_collapse_range() duplicate
the check in ext4_fallocate(). The checks are made with
inode lock held when there's no need for that. Remove them,
reducing the scope of the lock.

Signed-off-by: Davide Italiano <dccitaliano@...il.com>
---
 fs/ext4/extents.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index bed4308..9e6fa09 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4810,15 +4810,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	mutex_lock(&inode->i_mutex);
-
-	/*
-	 * Indirect files do not support unwritten extnets
-	 */
-	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
-		ret = -EOPNOTSUPP;
-		goto out_mutex;
-	}
-
 	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
 	     offset + len > i_size_read(inode)) {
 		new_size = offset + len;
@@ -5445,13 +5436,6 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 		ret = -EINVAL;
 		goto out_mutex;
 	}
-
-	/* Currently just for extent based files */
-	if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		ret = -EOPNOTSUPP;
-		goto out_mutex;
-	}
-
 	truncate_pagecache(inode, ioffset);
 
 	/* Wait for existing dio to complete */
-- 
2.3.4

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ