summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-04-26 16:03:57 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-07 18:18:54 -0700
commit1a0608e8df73a6b6902d5d154ab3abb546b43d8e (patch)
tree6d5709b872767a7ff3efa57e272ac508f3660d71
parent296f8da334a009ea2ec8112c2a1ac318872eff87 (diff)
downloadlinux-stable-1a0608e8df73a6b6902d5d154ab3abb546b43d8e.tar.gz
linux-stable-1a0608e8df73a6b6902d5d154ab3abb546b43d8e.tar.bz2
linux-stable-1a0608e8df73a6b6902d5d154ab3abb546b43d8e.zip
btrfs: add check to sysfs handler of label
commit 66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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;