From patchwork Fri Nov 4 05:41:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 15365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp192324wru; Thu, 3 Nov 2022 22:56:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jjYBBJyHqhoUyQI3lP/3iO3ZzgfzRaK9jP3cfMUagu6dm89A6y8GnfCHpljJ2IIDf4B// X-Received: by 2002:a17:907:7f02:b0:73d:dffa:57b3 with SMTP id qf2-20020a1709077f0200b0073ddffa57b3mr33936380ejc.19.1667541386170; Thu, 03 Nov 2022 22:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667541386; cv=none; d=google.com; s=arc-20160816; b=Zh7jpLU4XGllXgN4HStKIyY/XSvk1qm1GyPKitqpj5MWpwCXq+l9DYOszQT6WFgQm6 eaF11NS35+1dRxvMFgXSrLYUR+xuFra4Voy0AUj7lgkQ9avhF9OqAx6Ld160mq/LwvMu Vl87zIjsayJ2nfRRfPRUbkTWoMu8EnRApJjr5T/QMOe7QTwYOtyCNjto4eWpozCzma/u WkOWcP0jSPeOJV3lNojqB08V7HfoLox8MqRJadkRU/dMnUkFzdBwLCPcuYCDa+vrHRK1 rSXAp6ZunIsQncBdXUZtzACPd9nRjmTy3esKj4ii0wHJ2JjjJQLQQvS9o86ULJe4kK1h Dkyw== 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=4gzwZmQwxvaCPh0i1+e6XBsi/rXTapTh5YkJhDgSATg=; b=XUzASSOXTFwjj6DG+sbPF3iODnht0OWhVBOQxbaXPLJ47QRnknWCO07ogsAcTfsyr+ DWkNaZd9KSfUICLuzih330KoM12BaMBimoCWuOwxacWWl14T5hP9K7vQHthd7uL7o8+X JZdYXXwAanu/QFAn/zFMtI7e99ORLxUd5UGUwEsHAFHu4nT17omxehmaOLdyy8hVxis3 +jJAzeZ3tMhOe1TAeSjzZxIfJXVDTrCE11y1E1TvIBxdnyRTdBKBYrQYwo5rPF5/t+3W 4cRjhdfCK539apZVUkBxKZawq90VJwWPHlOmJ00heOh666x69dgH5Ju0VL3qVZq54QT9 VJhQ== 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 hg5-20020a1709072cc500b0078dcdbe650fsi4347381ejc.443.2022.11.03.22.56.03; Thu, 03 Nov 2022 22:56:26 -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 S231797AbiKDFvB (ORCPT + 99 others); Fri, 4 Nov 2022 01:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231280AbiKDFsx (ORCPT ); Fri, 4 Nov 2022 01:48:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF33D27B31; Thu, 3 Nov 2022 22:48:50 -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 F204D620D1; Fri, 4 Nov 2022 05:48:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67B04C4347C; Fri, 4 Nov 2022 05:48:48 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oqpZq-00716l-3C; Fri, 04 Nov 2022 01:49:14 -0400 Message-ID: <20221104054914.824782154@goodmis.org> User-Agent: quilt/0.66 Date: Fri, 04 Nov 2022 01:41:09 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Linus Torvalds , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Anna-Maria Gleixner , Andrew Morton , Karsten Keil , netdev@vger.kernel.org Subject: [RFC][PATCH v3 16/33] timers: mISDN: Use timer_shutdown_sync() before freeing timer References: <20221104054053.431922658@goodmis.org> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748543876545298405?= X-GMAIL-MSGID: =?utf-8?q?1748543876545298405?= From: "Steven Rostedt (Google)" Before a timer is freed, timer_shutdown_sync() must be called, or at least timer_shutdown() (where sync is not possible in the context). Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home/ Cc: Karsten Keil Cc: netdev@vger.kernel.org Signed-off-by: Steven Rostedt (Google) --- drivers/isdn/hardware/mISDN/hfcmulti.c | 6 ++---- drivers/isdn/mISDN/l1oip_core.c | 4 ++-- drivers/isdn/mISDN/timerdev.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index 4f7eaa17fb27..9c15c2c30e88 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c @@ -4543,10 +4543,8 @@ release_port(struct hfc_multi *hc, struct dchannel *dch) spin_lock_irqsave(&hc->lock, flags); - if (dch->timer.function) { - del_timer(&dch->timer); - dch->timer.function = NULL; - } + if (dch->timer.function) + timer_shutdown(&dch->timer); if (hc->ctype == HFC_TYPE_E1) { /* E1 */ /* remove sync */ diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index a77195e378b7..182e3f489c60 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -1236,8 +1236,8 @@ release_card(struct l1oip *hc) hc->shutdown = true; - del_timer_sync(&hc->keep_tl); - del_timer_sync(&hc->timeout_tl); + timer_shutdown_sync(&hc->keep_tl); + timer_shutdown_sync(&hc->timeout_tl); cancel_work_sync(&hc->workq); diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c index abdf36ac3bee..83d6b484d3c6 100644 --- a/drivers/isdn/mISDN/timerdev.c +++ b/drivers/isdn/mISDN/timerdev.c @@ -74,7 +74,7 @@ mISDN_close(struct inode *ino, struct file *filep) while (!list_empty(list)) { timer = list_first_entry(list, struct mISDNtimer, list); spin_unlock_irq(&dev->lock); - del_timer_sync(&timer->tl); + timer_shutdown_sync(&timer->tl); spin_lock_irq(&dev->lock); /* it might have been moved to ->expired */ list_del(&timer->list); @@ -204,7 +204,7 @@ misdn_del_timer(struct mISDNtimerdev *dev, int id) list_del_init(&timer->list); timer->id = -1; spin_unlock_irq(&dev->lock); - del_timer_sync(&timer->tl); + timer_shutdown_sync(&timer->tl); kfree(timer); return id; }