From: David Sterba Date: Tue, 26 Apr 2016 14:03:57 +0000 (+0200) Subject: btrfs: add check to sysfs handler of label X-Git-Tag: v4.9.8~1839^2~15^2~3^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66ac9fe7bacf9fa76c472efc7a7aaa590c7bce6a;p=platform%2Fkernel%2Flinux-rpi3.git 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 --- diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 6a6bb60..3d14618 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;