[PATCH 1/1] FS: attr, check ATTR_SIZE in ia_valid not ia_mode

From: Jiri Slaby
Date: Wed Jun 16 2010 - 17:51:12 EST


Fix a bug introduced by commit "check ATTR_SIZE contraints in
inode_change_ok" which added a size check, but checks the size even if
ATTR_SIZE is not in attr->ia_valid because it tests the bit in
attr->ia_mode.

Test properly against ia_valid.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
fs/attr.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/attr.c b/fs/attr.c
index 6959666..7ca4181 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -34,7 +34,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
* First check size constraints. These can't be overriden using
* ATTR_FORCE.
*/
- if (attr->ia_mode & ATTR_SIZE) {
+ if (ia_valid & ATTR_SIZE) {
int error = inode_newsize_ok(inode, attr->ia_size);
if (error)
return error;
--
1.7.1


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