netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2017-01-30
@ 2017-01-30 10:11 Marc Kleine-Budde
  2017-01-30 10:11 ` [PATCH] can: bcm: fix hrtimer/tasklet termination in bcm op removal Marc Kleine-Budde
  2017-01-30 21:39 ` pull-request: can 2017-01-30 David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2017-01-30 10:11 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux-can, kernel

Hello David,

this is a pull request of one patch.

The patch is by Oliver Hartkopp and fixes the hrtimer/tasklet termination in
bcm op removal.

regards,
Marc

---

The following changes since commit d1156b489fa734d1af763d6a07b1637c01bb0aed:

  net: adaptec: starfire: add checks for dma mapping errors (2017-01-29 19:04:11 -0500)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.10-20170130

for you to fetch changes up to a06393ed03167771246c4c43192d9c264bc48412:

  can: bcm: fix hrtimer/tasklet termination in bcm op removal (2017-01-30 11:05:04 +0100)

----------------------------------------------------------------
linux-can-fixes-for-4.10-20170130

----------------------------------------------------------------
Oliver Hartkopp (1):
      can: bcm: fix hrtimer/tasklet termination in bcm op removal

 net/can/bcm.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] can: bcm: fix hrtimer/tasklet termination in bcm op removal
  2017-01-30 10:11 pull-request: can 2017-01-30 Marc Kleine-Budde
@ 2017-01-30 10:11 ` Marc Kleine-Budde
  2017-01-30 21:39 ` pull-request: can 2017-01-30 David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2017-01-30 10:11 UTC (permalink / raw)
  To: netdev
  Cc: davem, linux-can, kernel, Oliver Hartkopp, linux-stable,
	Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

When removing a bcm tx operation either a hrtimer or a tasklet might run.
As the hrtimer triggers its associated tasklet and vice versa we need to
take care to mutually terminate both handlers.

Reported-by: Michael Josenhans <michael.josenhans@web.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Michael Josenhans <michael.josenhans@web.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/bcm.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 5c9407181918..95d13b233c65 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -734,14 +734,23 @@ static struct bcm_op *bcm_find_op(struct list_head *ops,
 
 static void bcm_remove_op(struct bcm_op *op)
 {
-	hrtimer_cancel(&op->timer);
-	hrtimer_cancel(&op->thrtimer);
-
-	if (op->tsklet.func)
-		tasklet_kill(&op->tsklet);
+	if (op->tsklet.func) {
+		while (test_bit(TASKLET_STATE_SCHED, &op->tsklet.state) ||
+		       test_bit(TASKLET_STATE_RUN, &op->tsklet.state) ||
+		       hrtimer_active(&op->timer)) {
+			hrtimer_cancel(&op->timer);
+			tasklet_kill(&op->tsklet);
+		}
+	}
 
-	if (op->thrtsklet.func)
-		tasklet_kill(&op->thrtsklet);
+	if (op->thrtsklet.func) {
+		while (test_bit(TASKLET_STATE_SCHED, &op->thrtsklet.state) ||
+		       test_bit(TASKLET_STATE_RUN, &op->thrtsklet.state) ||
+		       hrtimer_active(&op->thrtimer)) {
+			hrtimer_cancel(&op->thrtimer);
+			tasklet_kill(&op->thrtsklet);
+		}
+	}
 
 	if ((op->frames) && (op->frames != &op->sframe))
 		kfree(op->frames);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: pull-request: can 2017-01-30
  2017-01-30 10:11 pull-request: can 2017-01-30 Marc Kleine-Budde
  2017-01-30 10:11 ` [PATCH] can: bcm: fix hrtimer/tasklet termination in bcm op removal Marc Kleine-Budde
@ 2017-01-30 21:39 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-01-30 21:39 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 30 Jan 2017 11:11:00 +0100

> this is a pull request of one patch.
> 
> The patch is by Oliver Hartkopp and fixes the hrtimer/tasklet termination in
> bcm op removal.

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-30 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-30 10:11 pull-request: can 2017-01-30 Marc Kleine-Budde
2017-01-30 10:11 ` [PATCH] can: bcm: fix hrtimer/tasklet termination in bcm op removal Marc Kleine-Budde
2017-01-30 21:39 ` pull-request: can 2017-01-30 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).