瀏覽代碼

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>
David Sterba 9 年之前
父節點
當前提交
66ac9fe7ba
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      fs/btrfs/sysfs.c

+ 3 - 0
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;