diff options
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r-- | fs/udf/file.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index 356c2bf148a5..cd31e4f6d6da 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -257,12 +257,22 @@ const struct file_operations udf_file_operations = { | |||
257 | static int udf_setattr(struct dentry *dentry, struct iattr *attr) | 257 | static int udf_setattr(struct dentry *dentry, struct iattr *attr) |
258 | { | 258 | { |
259 | struct inode *inode = d_inode(dentry); | 259 | struct inode *inode = d_inode(dentry); |
260 | struct super_block *sb = inode->i_sb; | ||
260 | int error; | 261 | int error; |
261 | 262 | ||
262 | error = setattr_prepare(dentry, attr); | 263 | error = setattr_prepare(dentry, attr); |
263 | if (error) | 264 | if (error) |
264 | return error; | 265 | return error; |
265 | 266 | ||
267 | if ((attr->ia_valid & ATTR_UID) && | ||
268 | UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET) && | ||
269 | !uid_eq(attr->ia_uid, UDF_SB(sb)->s_uid)) | ||
270 | return -EPERM; | ||
271 | if ((attr->ia_valid & ATTR_GID) && | ||
272 | UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET) && | ||
273 | !gid_eq(attr->ia_gid, UDF_SB(sb)->s_gid)) | ||
274 | return -EPERM; | ||
275 | |||
266 | if ((attr->ia_valid & ATTR_SIZE) && | 276 | if ((attr->ia_valid & ATTR_SIZE) && |
267 | attr->ia_size != i_size_read(inode)) { | 277 | attr->ia_size != i_size_read(inode)) { |
268 | error = udf_setsize(inode, attr->ia_size); | 278 | error = udf_setsize(inode, attr->ia_size); |