diff mbox

hid-elo: kill not flush the work

Message ID 1464698895-6788-1-git-send-email-oneukum@suse.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Oliver Neukum May 31, 2016, 12:48 p.m. UTC
Flushing a work that reschedules itself is not a sensible
operation. It needs to be killed. Failure to do so leads
to a kernel panic in the timer code.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
---
 drivers/hid/hid-elo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Benjamin Tissoires May 31, 2016, 3:39 p.m. UTC | #1
On Tue, May 31, 2016 at 2:48 PM, Oliver Neukum <oneukum@suse.com> wrote:
> Flushing a work that reschedules itself is not a sensible
> operation. It needs to be killed. Failure to do so leads
> to a kernel panic in the timer code.
>
> Signed-off-by: Oliver Neukum <ONeukum@suse.com>
> CC: stable@vger.kernel.org

Good catch.
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks!
Benjamin

> ---
>  drivers/hid/hid-elo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c
> index aad8c16..0cd4f72 100644
> --- a/drivers/hid/hid-elo.c
> +++ b/drivers/hid/hid-elo.c
> @@ -261,7 +261,7 @@ static void elo_remove(struct hid_device *hdev)
>         struct elo_priv *priv = hid_get_drvdata(hdev);
>
>         hid_hw_stop(hdev);
> -       flush_workqueue(wq);
> +       cancel_delayed_work_sync(&priv->work);
>         kfree(priv);
>  }
>
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina June 1, 2016, 12:10 p.m. UTC | #2
On Tue, 31 May 2016, Oliver Neukum wrote:

> Flushing a work that reschedules itself is not a sensible
> operation. It needs to be killed. Failure to do so leads
> to a kernel panic in the timer code.

Applied to for-4.7/upstream-fixes. Thanks,
diff mbox

Patch

diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c
index aad8c16..0cd4f72 100644
--- a/drivers/hid/hid-elo.c
+++ b/drivers/hid/hid-elo.c
@@ -261,7 +261,7 @@  static void elo_remove(struct hid_device *hdev)
 	struct elo_priv *priv = hid_get_drvdata(hdev);
 
 	hid_hw_stop(hdev);
-	flush_workqueue(wq);
+	cancel_delayed_work_sync(&priv->work);
 	kfree(priv);
 }