Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3177041rwi; Fri, 28 Oct 2022 17:18:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AZRRTfGntsm01AQxEDfU45XgyWFwQs0+dbZXe1iXLGtr+y3Gi6vrBIyxoYFXwOxCST/rT X-Received: by 2002:a05:6402:2694:b0:45c:a035:34bc with SMTP id w20-20020a056402269400b0045ca03534bcmr1853970edd.158.1667002681964; Fri, 28 Oct 2022 17:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667002681; cv=none; d=google.com; s=arc-20160816; b=kpbEUR9lWlQ+UQ0Ib6KKV/J6FD9O+3j4vNHV+YahV0Bt73m9AfBzro0ZagEYccIW7s NexP6CHYqb/aSUJ0zF8e9fgSq4sEAZJ0Q55P+Z3Gg6M24I9JEAMtcGhsVuKKMNUYDTu8 M/ERpBdgRc84XcWQnQcdQ7tzxabLQ9GBZPEjxfjp8h2yygV8hQFCYaofTrdNStRWtkeN WEjQmnvtgUhH6gLh9Hafj7ccXNjATPbRIjwUKOONWkGrjOCk9pbipa6cNHYJybZ36qbK fEt8UpwRCIuSnEPXp+KjQKwfeNXR2KIcqTdFRls9cefuVKOgqTt1Si8+8z/WLRZ0GGSu nPGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=byQ111eujx+eXWvPavx0Kng5Y9HdyCkzb9o7x0jd+5M=; b=cvQig+DrIcsfDgDKTKt5sUbYYzApVSG/sp4nahFpxv8pCD/0mZGx/9llsAjHbAahoF 8D+L6UvXt0C/8ECZvXGJNXxI3j5ByIDyS5lsy8avHntOULCZ2I4QNsm+DXAXs4xXrA71 icSqWIEv3w7NrBT3UkZ4Y9j7ZPEEuedkUUPwH+SN/+cCiIc0XvXZaIrQ3mmBlmZ4Akjw I7aGW+/zdywlY2p4hK049lxyKRv5l+xbvx1DW4S1h+2e/5qsLBgOtmsTrl50W6LDzuYm Ae2rtfv3kj7eVCMQamenhFlEdRykT3RqPz6Cs/QANzqkd7OQFjUvKRcTIv/KmEif8dV7 nNIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OL1A0Ff6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170906134200b0078d3babe59bsi93761ejb.401.2022.10.28.17.17.32; Fri, 28 Oct 2022 17:18:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OL1A0Ff6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbiJ2ANH (ORCPT + 99 others); Fri, 28 Oct 2022 20:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiJ2ANG (ORCPT ); Fri, 28 Oct 2022 20:13:06 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C2A101E6; Fri, 28 Oct 2022 17:12:57 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id bp15so10685696lfb.13; Fri, 28 Oct 2022 17:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=byQ111eujx+eXWvPavx0Kng5Y9HdyCkzb9o7x0jd+5M=; b=OL1A0Ff6iaIu5eGmS8ZnJunVAoNFycUftrNojA3wKuX3NIbNPqk/Z7umwm5XjDtrFX 17p5387re66kqjxj93O+pQQc70XPrEHg/x8J50RZfWZol9ItMXBKFcw/VY1euIvDd8l4 +OBqMmsaFq9clWGguGeLi3BhWmCiWB/0zpKyAuvGLw6A4VzojMVQWA0z6qY4HWw/BdXG 4V1TF+DuGckOFCCjC7nwhv1DnOezvxZsep1mZGpjyQHcI4n8m8mz6pVIHWVJoXA5UK6i HQXOPTi/vG+CoTPxohaVm+YjOyvj7O9j1/v0KsmzCsKxBleRNqx6WugKMpd6EeP4db6r fNQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=byQ111eujx+eXWvPavx0Kng5Y9HdyCkzb9o7x0jd+5M=; b=XJbd0wnnmW3PfLCtgUr5BwKy7mh3ztvnPpsGxu9QSf8BdS8t7FZEFZp+rjOBRLfZys rmaM5gXW6c7XoM8DWAr8zIuOzP3JltcCbdZ6JA4D0Hs2RwvIJGQMqS/3NwbizsWs7+vg ZYubJCfC2VSfFFUXafNz3M/VSkp9G6SKWOYPClw2VhDfEAz1A9jmk6xU59qn0KFUXRQ1 fTNbTKJJdLtMGke99AlmYPjXm3XpMIHmFCRH2zf66zT58AJArgTnMvGY1FEFgDwxiys6 KILHwkIqS1uAYfdex24RddApUDy66BDOUB142XFfiHOLinNtJGmGgUgXkohSXu3ph5B/ 6VFQ== X-Gm-Message-State: ACrzQf2tqcJk7Mws3vU5MtZqwwq5hgWd7er5DamTeD3wyqfUvdRzPfBE FY/rPlF9EoanNv1rqxmaHOh/897+QG43uiyT1ck= X-Received: by 2002:a05:6512:3f2a:b0:4ae:612b:f47b with SMTP id y42-20020a0565123f2a00b004ae612bf47bmr674863lfa.106.1667002375575; Fri, 28 Oct 2022 17:12:55 -0700 (PDT) MIME-Version: 1.0 References: <20221027150525.753064657@goodmis.org> <20221027150926.587581591@goodmis.org> In-Reply-To: <20221027150926.587581591@goodmis.org> From: Luiz Augusto von Dentz Date: Fri, 28 Oct 2022 17:12:44 -0700 Message-ID: Subject: Re: [RFC][PATCH v2 08/31] timers: Bluetooth: Use del_timer_shutdown() before freeing timer To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Steven, On Thu, Oct 27, 2022 at 8:09 AM Steven Rostedt wrote: > > From: "Steven Rostedt (Google)" > > 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 > Cc: Johan Hedberg > Cc: Luiz Augusto von Dentz > Cc: linux-bluetooth@vger.kernel.org > Signed-off-by: Steven Rostedt (Google) Acked-by: Luiz Augusto von Dentz 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