Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: David Gstir <david@sigma-star.at>
To: linux-kernel@vger.kernel.org
Cc: daniel.lezcano@linaro.org, tglx@linutronix.de, richard@nod.at,
	stable@vger.kernel.org, Andres Salomon <dilinger@queued.net>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH] clockevents/drivers/cs5535: Un-break driver with 'set-state' interface
Date: Wed, 28 Dec 2016 22:56:03 +0100	[thread overview]
Message-ID: <20161228215603.6600-1-david@sigma-star.at> (raw)

Since migrating to the 'set-state' interface the cs5535 driver causes a
crash after loading: Right after initialization, the IRQ handler
(mfgpt_tick) is triggered with clock event device in detached state. This
state not properly handled and causes a crash through NULL pointer
dereference upon calling the clockevent's event_handler.

This patch fixes this by handling the detached state the same way the
shutdown state is handled.

Fixes: 8f9327cbb6e8 ("clockevents/drivers/cs5535: Migrate to new 'set-state' interface")
Cc: stable@vger.kernel.org
Cc: Andres Salomon <dilinger@queued.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: David Gstir <david@sigma-star.at>
---
 drivers/clocksource/cs5535-clockevt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c
index 9a7e37cf56b0..649e0cd90805 100644
--- a/drivers/clocksource/cs5535-clockevt.c
+++ b/drivers/clocksource/cs5535-clockevt.c
@@ -117,7 +117,8 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
 	/* Turn off the clock (and clear the event) */
 	disable_timer(cs5535_event_clock);
 
-	if (clockevent_state_shutdown(&cs5535_clockevent))
+	if (clockevent_state_shutdown(&cs5535_clockevent) ||
+			clockevent_state_detached(&cs5535_clockevent))
 		return IRQ_HANDLED;
 
 	/* Clear the counter */
-- 
2.11.0

             reply	other threads:[~2016-12-28 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 21:56 David Gstir [this message]
2017-01-02  9:34 ` [PATCH] clockevents/drivers/cs5535: Un-break driver with 'set-state' interface Viresh Kumar
     [not found]   ` <0d828ca5-4bc1-213b-f8ce-d4cfbbe9e619@linaro.org>
2017-01-04 14:22     ` David Gstir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161228215603.6600-1-david@sigma-star.at \
    --to=david@sigma-star.at \
    --cc=daniel.lezcano@linaro.org \
    --cc=dilinger@queued.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox