Commit c4d029f2 authored by Thomas Gleixner's avatar Thomas Gleixner

tick/broadcast: Prevent NULL pointer dereference

Dan reported that the recent changes to the broadcast code introduced
a potential NULL dereference.

Add the proper check.

Fixes: e0454311 "tick/broadcast: Sanity check the shutdown of the local clock_event"
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 1f6823fa
...@@ -409,14 +409,16 @@ void tick_broadcast_control(enum tick_broadcast_mode mode) ...@@ -409,14 +409,16 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
break; break;
} }
if (cpumask_empty(tick_broadcast_mask)) { if (bc) {
if (!bc_stopped) if (cpumask_empty(tick_broadcast_mask)) {
clockevents_shutdown(bc); if (!bc_stopped)
} else if (bc_stopped) { clockevents_shutdown(bc);
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) } else if (bc_stopped) {
tick_broadcast_start_periodic(bc); if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
else tick_broadcast_start_periodic(bc);
tick_broadcast_setup_oneshot(bc); else
tick_broadcast_setup_oneshot(bc);
}
} }
raw_spin_unlock(&tick_broadcast_lock); raw_spin_unlock(&tick_broadcast_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment