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

Commit e5d355ac authored by Trilok Soni's avatar Trilok Soni Committed by Gerrit - the friendly Code Review server
Browse files

qcom: msm: event-timer: Check the cpu num before adding a new event-timer



The cpu on which the new event timer is setup is calculated from
the cpumask data sent to the api. Add a check to make sure that
the calculated cpu number is within bounds. If the cpu number is
out of bounds, use the first online cpu to setup the event timer.

Also add the same bounds check to the cpu used in the irq affinity
change notifier.

Change-Id: I9f552ec506f0e69188a60884c4d820782196e5cf
Signed-off-by: default avatarKarthik Parsha <kparsha@codeaurora.org>
parent d96b4bb7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -101,6 +101,9 @@ struct event_timer_info *add_event_timer(uint32_t irq,

		get_online_cpus();
		event_info->cpu = cpumask_any_and(mask, cpu_online_mask);
		if (event_info->cpu >= nr_cpu_ids)
			event_info->cpu = cpumask_first(cpu_online_mask);

		event_info->notify.notify = irq_affinity_change_notifier;
		event_info->notify.release = irq_affinity_release;
		irq_set_affinity_notifier(irq, &event_info->notify);
@@ -307,6 +310,9 @@ static void irq_affinity_change_notifier(struct irq_affinity_notify *notify,
	 * the next affinity CPU.
	 */
	new_cpu = cpumask_any_and(mask_val, cpu_online_mask);
	if (new_cpu >= nr_cpu_ids)
		return;

	old_cpu = event->cpu;

	if (msm_event_debug_mask && MSM_EVENT_TIMER_DEBUG)