diff options
author | David Sterba <dsterba@suse.com> | 2016-04-26 16:03:57 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-06 15:22:49 +0200 |
commit | 66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a (patch) | |
tree | 80dd3ffed00f80e51ae904db05bcfc660ac683af /fs/btrfs/sysfs.c | |
parent | ee6111386a1b304f8bf589d36810d53e3b27ee20 (diff) | |
download | linux-66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a.tar.gz linux-66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a.tar.bz2 linux-66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a.zip |
btrfs: add check to sysfs handler of label
Add a sanity check for the fs_info as we will dereference it, similar to
what the 'store features' handler does.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r-- | fs/btrfs/sysfs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 6a6bb600b1ff..3d14618ce54b 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -377,6 +377,9 @@ static ssize_t btrfs_label_store(struct kobject *kobj, struct btrfs_fs_info *fs_info = to_fs_info(kobj); size_t p_len; + if (!fs_info) + return -EPERM; + if (fs_info->sb->s_flags & MS_RDONLY) return -EROFS; |