diff options
author | Chris Mason <chris.mason@oracle.com> | 2010-01-17 20:36:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-13 13:20:04 -0700 |
commit | f7733c6a95d6406a55b6e29b2ff15ac22f741bc5 (patch) | |
tree | f792724b916ae322085adbf8fa3881c94877c8c2 /fs | |
parent | 3d31143c5687d5291aa8b43126a2befba84c03b4 (diff) |
Btrfs: deal with NULL acl sent to btrfs_set_acl
commit a9cc71a60c29a09174bee2fcef8f924c529fd4b7 upstream.
It is legal for btrfs_set_acl to be sent a NULL acl. This
makes sure we don't dereference it. A similar patch was sent by
Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/acl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 799bae9176a8..c40ca80a0b7b 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -112,12 +112,14 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans, switch (type) { case ACL_TYPE_ACCESS: mode = inode->i_mode; - ret = posix_acl_equiv_mode(acl, &mode); - if (ret < 0) - return ret; - ret = 0; - inode->i_mode = mode; name = POSIX_ACL_XATTR_ACCESS; + if (acl) { + ret = posix_acl_equiv_mode(acl, &mode); + if (ret < 0) + return ret; + inode->i_mode = mode; + } + ret = 0; break; case ACL_TYPE_DEFAULT: if (!S_ISDIR(inode->i_mode)) |