Johannes Hirte
2010-Jan-05 20:33 UTC
[PATCH] check for NULL pointer dereference in btrfs_set_acl
Check for for NULL pointer in btrfs_set_acl and omit calling posix_acl_equiv_mode in this case to avoid NULL pointer dereference there. Signed-off-by: Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de> diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2e9e699..3a3a96d 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -111,13 +111,15 @@ 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) { + mode = inode->i_mode; + ret = posix_acl_equiv_mode(acl, &mode); + if (ret < 0) + return ret; + ret = 0; + inode->i_mode = mode; + } break; case ACL_TYPE_DEFAULT: if (!S_ISDIR(inode->i_mode))