Linux-Bluetooth Archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer
       [not found] <20221027150525.753064657@goodmis.org>
@ 2022-10-27 15:05 ` Steven Rostedt
  2022-10-29  0:12   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2022-10-27 15:05 UTC (permalink / raw
  To: linux-kernel
  Cc: Linus Torvalds, Thomas Gleixner, Stephen Boyd, Guenter Roeck,
	Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Before a timer is freed, del_timer_shutdown() must be called.

Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/

Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 drivers/bluetooth/hci_bcsp.c | 2 +-
 drivers/bluetooth/hci_h5.c   | 2 +-
 drivers/bluetooth/hci_qca.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index cf4a56095817..69caaff37141 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -737,7 +737,7 @@ static int bcsp_close(struct hci_uart *hu)
 {
 	struct bcsp_struct *bcsp = hu->priv;
 
-	del_timer_sync(&bcsp->tbcsp);
+	del_timer_shutdown(&bcsp->tbcsp);
 
 	hu->priv = NULL;
 
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index c5a0409ef84f..08a36ea9eea9 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -253,7 +253,7 @@ static int h5_close(struct hci_uart *hu)
 {
 	struct h5 *h5 = hu->priv;
 
-	del_timer_sync(&h5->timer);
+	del_timer_shutdown(&h5->timer);
 
 	skb_queue_purge(&h5->unack);
 	skb_queue_purge(&h5->rel);
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 8df11016fd51..1796166ba35d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -697,8 +697,8 @@ static int qca_close(struct hci_uart *hu)
 	skb_queue_purge(&qca->txq);
 	skb_queue_purge(&qca->rx_memdump_q);
 	destroy_workqueue(qca->workqueue);
-	del_timer_sync(&qca->tx_idle_timer);
-	del_timer_sync(&qca->wake_retrans_timer);
+	del_timer_shutdown(&qca->tx_idle_timer);
+	del_timer_shutdown(&qca->wake_retrans_timer);
 	qca->hu = NULL;
 
 	kfree_skb(qca->rx_skb);
-- 
2.35.1

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

* Re: [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer
  2022-10-27 15:05 ` [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer Steven Rostedt
@ 2022-10-29  0:12   ` Luiz Augusto von Dentz
  2022-10-29  0:33     ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-10-29  0:12 UTC (permalink / raw
  To: Steven Rostedt
  Cc: linux-kernel, Linus Torvalds, Thomas Gleixner, Stephen Boyd,
	Guenter Roeck, Marcel Holtmann, Johan Hedberg, linux-bluetooth

Hi Steven,

On Thu, Oct 27, 2022 at 8:09 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
>
> Before a timer is freed, del_timer_shutdown() must be called.
>
> Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/
>
> Cc: Marcel Holtmann <marcel@holtmann.org>
> Cc: Johan Hedberg <johan.hedberg@gmail.com>
> Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Cc: linux-bluetooth@vger.kernel.org
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Acked-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Btw, we do seem to have similar problems with the likes of
cancel_delayed_work/cancel_delayed_work_sync so wonder if it wouldn't
be the case to introduce something like shutdown_delayed_work before
freeing the struct/object containing it?

> ---
>  drivers/bluetooth/hci_bcsp.c | 2 +-
>  drivers/bluetooth/hci_h5.c   | 2 +-
>  drivers/bluetooth/hci_qca.c  | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
> index cf4a56095817..69caaff37141 100644
> --- a/drivers/bluetooth/hci_bcsp.c
> +++ b/drivers/bluetooth/hci_bcsp.c
> @@ -737,7 +737,7 @@ static int bcsp_close(struct hci_uart *hu)
>  {
>         struct bcsp_struct *bcsp = hu->priv;
>
> -       del_timer_sync(&bcsp->tbcsp);
> +       del_timer_shutdown(&bcsp->tbcsp);
>
>         hu->priv = NULL;
>
> diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
> index c5a0409ef84f..08a36ea9eea9 100644
> --- a/drivers/bluetooth/hci_h5.c
> +++ b/drivers/bluetooth/hci_h5.c
> @@ -253,7 +253,7 @@ static int h5_close(struct hci_uart *hu)
>  {
>         struct h5 *h5 = hu->priv;
>
> -       del_timer_sync(&h5->timer);
> +       del_timer_shutdown(&h5->timer);
>
>         skb_queue_purge(&h5->unack);
>         skb_queue_purge(&h5->rel);
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 8df11016fd51..1796166ba35d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -697,8 +697,8 @@ static int qca_close(struct hci_uart *hu)
>         skb_queue_purge(&qca->txq);
>         skb_queue_purge(&qca->rx_memdump_q);
>         destroy_workqueue(qca->workqueue);
> -       del_timer_sync(&qca->tx_idle_timer);
> -       del_timer_sync(&qca->wake_retrans_timer);
> +       del_timer_shutdown(&qca->tx_idle_timer);
> +       del_timer_shutdown(&qca->wake_retrans_timer);
>         qca->hu = NULL;
>
>         kfree_skb(qca->rx_skb);
> --
> 2.35.1



-- 
Luiz Augusto von Dentz

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

* Re: [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer
  2022-10-29  0:12   ` Luiz Augusto von Dentz
@ 2022-10-29  0:33     ` Steven Rostedt
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2022-10-29  0:33 UTC (permalink / raw
  To: Luiz Augusto von Dentz
  Cc: linux-kernel, Linus Torvalds, Thomas Gleixner, Stephen Boyd,
	Guenter Roeck, Marcel Holtmann, Johan Hedberg, linux-bluetooth

On Fri, 28 Oct 2022 17:12:44 -0700
Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote:

> Acked-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Thanks, but I will be sending a v2 as the naming is going to change.

> 
> Btw, we do seem to have similar problems with the likes of
> cancel_delayed_work/cancel_delayed_work_sync so wonder if it wouldn't
> be the case to introduce something like shutdown_delayed_work before
> freeing the struct/object containing it?

As I stated here:

  https://lore.kernel.org/all/20221028100052.2e392127@gandalf.local.home/

That may be the next endevour I partake in.


Cheers,

-- Steve

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

end of thread, other threads:[~2022-10-29  0:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20221027150525.753064657@goodmis.org>
2022-10-27 15:05 ` [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer Steven Rostedt
2022-10-29  0:12   ` Luiz Augusto von Dentz
2022-10-29  0:33     ` Steven Rostedt

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 read-only IMAP folder(s) and NNTP newsgroup(s).