Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1109914rwb; Sun, 6 Nov 2022 19:39:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM6o6N05K1SD9eD/Lb1j1OL7W8j+Cl7ZoZmJ/vAQpFR1gs607nf7nbpM+Q5vC/hOXt5e72+D X-Received: by 2002:a17:906:16d9:b0:7ad:a2ef:54c8 with SMTP id t25-20020a17090616d900b007ada2ef54c8mr46878769ejd.632.1667792346543; Sun, 06 Nov 2022 19:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667792346; cv=none; d=google.com; s=arc-20160816; b=SdwHiJpesoEXWNZaoCOcb2blrIS9M2zqFqoZB7odUxbGUlw/59NdFeWNnhUQKgk6wl m0VY2JM8VFjzrLN5p5CNKT2FKUwyP7vevUJZGD8vEp2quDEPJVTQ6BlcTeTuhJGixu4N HqP0d98rHbBuqgT13lCutEReWcewhtR7SSM/wjqyVrmZW0bau4az1fXwlzUgN2Od0Aq6 LuBf1zCfFDlfD/4sBVYovCoXVoJkFEtE0ma5+YdCxcGR7pMURWR9tJVMO1NbyqgS788T npAWm/rt/cNxM6ZRpdBGmUhVd43iWcLxf4a/uQxJmsmPa3t6b4ufbTnIAe07NzA3nUHO PwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=gX+j/S1mP49tBGzfhC9ujyM6S+9Mqjr93zRB6USsI6U=; b=fsGQ7GspiHSflC+0TSUeuJtjVVURsx0Z1oXV5w1FDIDh0bNcce++rzShOXZbWZdRj5 SYh6u2kcsSSRxzJH6eiql0oxNSbi7zP98s6fQFTh78VTtHhktcJVLK9HD5xMwQEekSGU qa9ZLA6gstGWjYhY7ZyAUEuAtHkfkhw14QqsJC2vfLzqNL+nSDlvtIOscnNVzwGmgOpF m2E4c7LYBbDp8W/kr7icjvrStP2I0DlagGh9GQIOoS93P0YKyVNoVw73/OqQMgZg427l QWSLh5VV7GNOjMXBfN6ekoTvBuQ1IMTtJrHYXh737tDYsRI0O/ZrhmelI2Aee2G+FrRZ kNdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t20-20020a056402021400b0045bfaaab6d1si7625113edv.48.2022.11.06.19.38.39; Sun, 06 Nov 2022 19:39:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiKGDdC (ORCPT + 99 others); Sun, 6 Nov 2022 22:33:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbiKGDdC (ORCPT ); Sun, 6 Nov 2022 22:33:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D587D9FCC; Sun, 6 Nov 2022 19:33:00 -0800 (PST) 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 6628D60EA7; Mon, 7 Nov 2022 03:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 780BFC433C1; Mon, 7 Nov 2022 03:32:58 +0000 (UTC) Date: Sun, 6 Nov 2022 22:32:56 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Thomas Gleixner , Stephen Boyd , Guenter Roeck , Anna-Maria Gleixner , Andrew Morton , Julia Lawall , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-acpi@vger.kernel.org, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, drbd-dev@lists.linbit.com, linux-bluetooth@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-media@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, linux-scsi@vger.kernel.org, linux-staging@lists.linux.dev, linux-ext4@vger.kernel.org, linux-nilfs@vger.kernel.org, bridge@lists.linux-foundation.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, lvs-devel@vger.kernel.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net, alsa-devel@alsa-project.org Subject: [GIT PULL] treewide: timers: Use timer_shutdown*() before freeing timers Message-ID: <20221106223256.4bbdb018@rorschach.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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-ext4@vger.kernel.org Linus, As discussed here: https://lore.kernel.org/all/20221106212427.739928660@goodmis.org/ Add a "shutdown" state for timers. This is performed by the new timer_shutdown_sync() and timer_shutdown() function calls. When this is called on a timer, it will no longer be able to be re-armed. This should be called before a timer is freed to prevent it from being re-armed after being removed from the timer queue and then causing a crash in the timer code when the timer triggers. This required renaming some functions that were using the name timer_shutdown() statically to something more appropriate. Then a coccinelle script was executed on the entire kernel tree to find the trivial locations that remove the timer and then frees the object that the timer exists on. These changes are not enough to solve all the locations where timers may be of an issue. But by adding the shutdown infrastructure and the obvious cases, the more complex cases can be added after they have been reviewed more closely. Please pull the following tree, which can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git add-timer-shutdown Tag SHA1: 7685328352dfd2908e23048f563e328dbd3526e9 Head SHA1: 870556da63870e01ade9bb8418ac5a21862f2f10 Steven Rostedt (Google) (5): ARM: spear: Do not use timer namespace for timer_shutdown() function clocksource/drivers/arm_arch_timer: Do not use timer namespace for timer_shutdown() function clocksource/drivers/sp804: Do not use timer namespace for timer_shutdown() function timers: Add timer_shutdown_sync() and timer_shutdown() to be called before freeing timers treewide: Convert del_timer*() to timer_shutdown*() ---- .../RCU/Design/Requirements/Requirements.rst | 2 +- Documentation/core-api/local_ops.rst | 2 +- Documentation/kernel-hacking/locking.rst | 5 ++ arch/arm/mach-spear/time.c | 8 +-- arch/sh/drivers/push-switch.c | 2 +- block/blk-iocost.c | 2 +- block/blk-iolatency.c | 2 +- block/kyber-iosched.c | 2 +- drivers/acpi/apei/ghes.c | 2 +- drivers/atm/idt77252.c | 6 +- drivers/block/drbd/drbd_main.c | 2 +- drivers/block/loop.c | 2 +- drivers/bluetooth/hci_bcsp.c | 2 +- drivers/bluetooth/hci_qca.c | 4 +- drivers/clocksource/arm_arch_timer.c | 12 ++-- drivers/clocksource/timer-sp804.c | 6 +- drivers/gpu/drm/i915/i915_sw_fence.c | 2 +- drivers/hid/hid-wiimote-core.c | 2 +- drivers/input/keyboard/locomokbd.c | 2 +- drivers/input/keyboard/omap-keypad.c | 2 +- drivers/input/mouse/alps.c | 2 +- drivers/isdn/mISDN/l1oip_core.c | 4 +- drivers/isdn/mISDN/timerdev.c | 4 +- drivers/leds/trigger/ledtrig-activity.c | 2 +- drivers/leds/trigger/ledtrig-heartbeat.c | 2 +- drivers/leds/trigger/ledtrig-pattern.c | 2 +- drivers/leds/trigger/ledtrig-transient.c | 2 +- drivers/media/pci/ivtv/ivtv-driver.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 16 +++--- drivers/media/usb/s2255/s2255drv.c | 4 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +- drivers/net/ethernet/marvell/sky2.c | 2 +- drivers/net/ethernet/sun/sunvnet.c | 2 +- drivers/net/usb/sierra_net.c | 2 +- .../wireless/broadcom/brcm80211/brcmfmac/btcoex.c | 2 +- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 +- drivers/net/wireless/intersil/hostap/hostap_ap.c | 2 +- drivers/net/wireless/marvell/mwifiex/main.c | 2 +- drivers/net/wireless/microchip/wilc1000/hif.c | 6 +- drivers/nfc/pn533/pn533.c | 2 +- drivers/nfc/pn533/uart.c | 2 +- drivers/pcmcia/bcm63xx_pcmcia.c | 2 +- drivers/pcmcia/electra_cf.c | 2 +- drivers/pcmcia/omap_cf.c | 2 +- drivers/pcmcia/pd6729.c | 4 +- drivers/pcmcia/yenta_socket.c | 4 +- drivers/scsi/qla2xxx/qla_edif.c | 4 +- drivers/staging/media/atomisp/i2c/atomisp-lm3554.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/sysrq.c | 2 +- drivers/usb/gadget/udc/m66592-udc.c | 2 +- drivers/usb/serial/garmin_gps.c | 2 +- drivers/usb/serial/mos7840.c | 4 +- fs/ext4/super.c | 2 +- fs/nilfs2/segment.c | 2 +- include/linux/timer.h | 62 +++++++++++++++++++-- kernel/time/timer.c | 64 ++++++++++++---------- net/802/garp.c | 2 +- net/802/mrp.c | 4 +- net/bridge/br_multicast.c | 8 +-- net/bridge/br_multicast_eht.c | 4 +- net/core/gen_estimator.c | 2 +- net/ipv4/ipmr.c | 2 +- net/ipv6/ip6mr.c | 2 +- net/mac80211/mesh_pathtbl.c | 2 +- net/netfilter/ipset/ip_set_list_set.c | 2 +- net/netfilter/ipvs/ip_vs_lblc.c | 2 +- net/netfilter/ipvs/ip_vs_lblcr.c | 2 +- net/netfilter/xt_IDLETIMER.c | 4 +- net/netfilter/xt_LED.c | 2 +- net/rxrpc/conn_object.c | 2 +- net/sched/cls_flow.c | 2 +- net/sunrpc/svc.c | 2 +- net/tipc/discover.c | 2 +- net/tipc/monitor.c | 2 +- sound/i2c/other/ak4117.c | 2 +- sound/synth/emux/emux.c | 2 +- 78 files changed, 207 insertions(+), 148 deletions(-) ---------------------------