Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 609ef361 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpufreq: interactive: fix NULL pointer dereference at sysfs ops"

parents f85a40b2 ababac55
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
@@ -1256,18 +1256,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
			return -ENOMEM;
		}

		if (!have_governor_per_policy())
			WARN_ON(cpufreq_get_global_kobject());

		rc = sysfs_create_group(get_governor_parent_kobj(policy),
				get_sysfs_attr());
		if (rc) {
			kfree(tunables);
			if (!have_governor_per_policy())
				cpufreq_put_global_kobject();
			return rc;
		}

		tunables->usage_count = 1;
		tunables->above_hispeed_delay = default_above_hispeed_delay;
		tunables->nabove_hispeed_delay =
@@ -1283,16 +1271,30 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
		spin_lock_init(&tunables->target_loads_lock);
		spin_lock_init(&tunables->above_hispeed_delay_lock);

		policy->governor_data = tunables;
		if (!have_governor_per_policy()) {
			WARN_ON(cpufreq_get_global_kobject());
			common_tunables = tunables;
		}

		rc = sysfs_create_group(get_governor_parent_kobj(policy),
				get_sysfs_attr());
		if (rc) {
			kfree(tunables);
			policy->governor_data = NULL;
			if (!have_governor_per_policy()) {
				common_tunables = NULL;
				cpufreq_put_global_kobject();
			}
			return rc;
		}

		if (!policy->governor->initialized) {
			idle_notifier_register(&cpufreq_interactive_idle_nb);
			cpufreq_register_notifier(&cpufreq_notifier_block,
					CPUFREQ_TRANSITION_NOTIFIER);
		}

		policy->governor_data = tunables;
		if (!have_governor_per_policy())
			common_tunables = tunables;

		break;

	case CPUFREQ_GOV_POLICY_EXIT: