diff options
Diffstat (limited to 'fs/xfs/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 6108955b199d..ef0508945267 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -389,18 +389,20 @@ xfs_attrmulti_attr_set( uint32_t len, uint32_t flags) { - unsigned char *kbuf; + unsigned char *kbuf = NULL; int error; size_t namelen; if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) return -EPERM; - if (len > XFS_XATTR_SIZE_MAX) - return -EINVAL; - kbuf = memdup_user(ubuf, len); - if (IS_ERR(kbuf)) - return PTR_ERR(kbuf); + if (ubuf) { + if (len > XFS_XATTR_SIZE_MAX) + return -EINVAL; + kbuf = memdup_user(ubuf, len); + if (IS_ERR(kbuf)) + return PTR_ERR(kbuf); + } namelen = strlen(name); error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags); @@ -410,22 +412,6 @@ xfs_attrmulti_attr_set( return error; } -int -xfs_attrmulti_attr_remove( - struct inode *inode, - unsigned char *name, - uint32_t flags) -{ - int error; - - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - return -EPERM; - error = xfs_attr_set(XFS_I(inode), name, strlen(name), NULL, 0, flags); - if (!error) - xfs_forget_acl(inode, name, flags); - return error; -} - STATIC int xfs_attrmulti_by_handle( struct file *parfilp, @@ -504,8 +490,8 @@ xfs_attrmulti_by_handle( ops[i].am_error = mnt_want_write_file(parfilp); if (ops[i].am_error) break; - ops[i].am_error = xfs_attrmulti_attr_remove( - d_inode(dentry), attr_name, + ops[i].am_error = xfs_attrmulti_attr_set( + d_inode(dentry), attr_name, NULL, 0, ops[i].am_flags); mnt_drop_write_file(parfilp); break; |