Skip to content

Commit

Permalink
tick/broadcast: Prevent NULL pointer dereference
Browse files Browse the repository at this point in the history
Dan reported that the recent changes to the broadcast code introduced
a potential NULL dereference.

Add the proper check.

Fixes: e045431 "tick/broadcast: Sanity check the shutdown of the local clock_event"
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner committed Jul 11, 2015
1 parent 1f6823f commit c4d029f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions kernel/time/tick-broadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,16 @@ void tick_broadcast_control(enum tick_broadcast_mode mode)
break;
}

if (cpumask_empty(tick_broadcast_mask)) {
if (!bc_stopped)
clockevents_shutdown(bc);
} else if (bc_stopped) {
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
tick_broadcast_start_periodic(bc);
else
tick_broadcast_setup_oneshot(bc);
if (bc) {
if (cpumask_empty(tick_broadcast_mask)) {
if (!bc_stopped)
clockevents_shutdown(bc);
} else if (bc_stopped) {
if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
tick_broadcast_start_periodic(bc);
else
tick_broadcast_setup_oneshot(bc);
}
}
raw_spin_unlock(&tick_broadcast_lock);
}
Expand Down

0 comments on commit c4d029f

Please sign in to comment.