Message ID | 20221027150926.587581591@goodmis.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp286670wru; Thu, 27 Oct 2022 08:11:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XSOlYV6NECfffUQCcrUy3eQgzRf56IuyL2Z6HAXSQaC2PxFD8AQZZ3wmSLPX1MAOSI6Dv X-Received: by 2002:a17:906:9bd8:b0:78d:85f9:36ae with SMTP id de24-20020a1709069bd800b0078d85f936aemr43295857ejc.342.1666883468000; Thu, 27 Oct 2022 08:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666883467; cv=none; d=google.com; s=arc-20160816; b=T3o1L1kF9SrFkSXXJ3RTWDswFGBhWj3te4ZaJdakp8VueUjy4Gjxbld+8GCMKZYGqe AtMLsJbuFcMSb50DNUklj5HaAe+0b/zTEg7yW32iooKuM3MQR97/ZsP1uQ+hJkjBQLZt vj/1jdEdd/nNlRdjQfjGrj9UPfpt7sRAoZ2QdY4RrFiVscPdVAAQrE0BdpyjAzEKXqZ2 ZiHvCIZHa16zmKkyTbOnanr6jg+WeCoIqpndQ7SsPR9rjS19VLf6HDbtH7Q/svfKWvf6 4Q3zAEk8t8iNLnwl8/oSUdSpdxffk9dTdb6PPXwgQr62f0flw5rqkq97oCOMTsyv3Rex 14Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=dwbk4ip1Y97M92+SVR+/StU9XSOK8x7PmLHV5xAygd8=; b=xG2uXpfHl6OUqRf37obWh9c3MBEZ8D+xCAyhR75RkHcQ7/e7PM4svJLOC6BekuGCCE bpoO933zV83SDtfokGzAMvD/VxrpSscWv4sif6P9wYXUcxrqJSkL8f6UUjo/Jdw70nhy 8GhHoLEufycEQejSvSCjNL+xCUlx0Z2rC9Wx9lsC/NgEjQ6w/Isy4PTbGhQ+Ki6jm0xl xhEz17xqdjLISCziIZEPnHigM040FI0Iq2jF6cNz6aEzytPRnevxGq786fvgC9TKbkvh PtMfkKP3h2rwGVJK4GM/KWrpPJeEMxdyuVsY71lxWzsaL8lguS8hTan6CigZPXDF1iRs ugMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz11-20020a0564021d4b00b0045d292ef641si2112878edb.493.2022.10.27.08.10.42; Thu, 27 Oct 2022 08:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236357AbiJ0PKA (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Thu, 27 Oct 2022 11:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236247AbiJ0PJO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 27 Oct 2022 11:09:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367DE18F0D9; Thu, 27 Oct 2022 08:09:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E706623A4; Thu, 27 Oct 2022 15:09:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D0FFC43148; Thu, 27 Oct 2022 15:09:11 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from <rostedt@goodmis.org>) id 1oo4Va-00BvW0-2R; Thu, 27 Oct 2022 11:09:26 -0400 Message-ID: <20221027150926.587581591@goodmis.org> User-Agent: quilt/0.66 Date: Thu, 27 Oct 2022 11:05:33 -0400 From: Steven Rostedt <rostedt@goodmis.org> To: linux-kernel@vger.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org>, Thomas Gleixner <tglx@linutronix.de>, Stephen Boyd <sboyd@kernel.org>, Guenter Roeck <linux@roeck-us.net>, Marcel Holtmann <marcel@holtmann.org>, Johan Hedberg <johan.hedberg@gmail.com>, Luiz Augusto von Dentz <luiz.dentz@gmail.com>, linux-bluetooth@vger.kernel.org Subject: [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer References: <20221027150525.753064657@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747853999124042142?= X-GMAIL-MSGID: =?utf-8?q?1747853999124042142?= |
Series |
timers: Use del_timer_shutdown() before freeing timers
|
|
Commit Message
Steven Rostedt
Oct. 27, 2022, 3:05 p.m. UTC
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(-)
Comments
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
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
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);