Skip to content

Commit

Permalink
btrfs: return error instead of crash when detecting unexpected type i…
Browse files Browse the repository at this point in the history
…n btrfs_get_acl

The caller of btrfs_get_acl() checks error condition so there is no
impact from this change. In practice there is no chance to get into
default case of switch statement because VFS has already checked the
type.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Chengguang Xu authored and David Sterba committed Aug 6, 2018
1 parent af431dc commit ab3629e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
name = XATTR_NAME_POSIX_ACL_DEFAULT;
break;
default:
BUG();
return ERR_PTR(-EINVAL);
}

size = btrfs_getxattr(inode, name, "", 0);
Expand Down

0 comments on commit ab3629e

Please sign in to comment.