Skip to content

Commit 0d29ed2

Browse files
committed
Merge tag 'linux-can-fixes-for-4.10-20170130' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== pull-request: can 2017-01-30 this is a pull request of one patch. The patch is by Oliver Hartkopp and fixes the hrtimer/tasklet termination in bcm op removal. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 2b89ed6 + a06393e commit 0d29ed2

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

net/can/bcm.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,14 +734,23 @@ static struct bcm_op *bcm_find_op(struct list_head *ops,
734734

735735
static void bcm_remove_op(struct bcm_op *op)
736736
{
737-
hrtimer_cancel(&op->timer);
738-
hrtimer_cancel(&op->thrtimer);
739-
740-
if (op->tsklet.func)
741-
tasklet_kill(&op->tsklet);
737+
if (op->tsklet.func) {
738+
while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) ||
739+
test_bit(TASKLET_STATE_RUN, &op->tsklet.state) ||
740+
hrtimer_active(&op->timer)) {
741+
hrtimer_cancel(&op->timer);
742+
tasklet_kill(&op->tsklet);
743+
}
744+
}
742745

743-
if (op->thrtsklet.func)
744-
tasklet_kill(&op->thrtsklet);
746+
if (op->thrtsklet.func) {
747+
while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) ||
748+
test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) ||
749+
hrtimer_active(&op->thrtimer)) {
750+
hrtimer_cancel(&op->thrtimer);
751+
tasklet_kill(&op->thrtsklet);
752+
}
753+
}
745754

746755
if ((op->frames) && (op->frames != &op->sframe))
747756
kfree(op->frames);

0 commit comments

Comments
 (0)