summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-26 16:03:57 +0200
committerDavid Sterba <dsterba@suse.com>2016-05-06 15:22:49 +0200
commit66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a (patch)
tree80dd3ffed00f80e51ae904db05bcfc660ac683af /fs/btrfs/sysfs.c
parentee6111386a1b304f8bf589d36810d53e3b27ee20 (diff)
downloadlinux-66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a.tar.bz2
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.c3
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;