Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp568957rwe; Fri, 14 Apr 2023 07:03:44 -0700 (PDT) X-Google-Smtp-Source: AKy350ZhXG7QEupy/W4RW0Te/Jf905it8s6oixYfCRoBS5Ru7H2KIzurfCmUi0i5XI2/AG3KWPVL X-Received: by 2002:a1f:3f10:0:b0:440:5f56:dcc5 with SMTP id m16-20020a1f3f10000000b004405f56dcc5mr1682885vka.0.1681481023939; Fri, 14 Apr 2023 07:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681481023; cv=none; d=google.com; s=arc-20160816; b=mX45/B9tfI+vEdHDqY57YL5kVZwx7D6Cnjfuglw+pzF1ItWOxRmVvZ5+ryKIcKSIj5 mlHNwFsxpuGMV4+Gz7ie2ZZxlczY8GA/6k7BqmfZ3/QWwPVtggPgj55khCEYPYI1GldI LZ9ZMCNuHc905Qqgu5BGf/46zYIGMN9UXoIwi1IAUFoaBeqKAIRLpISp6CX4wmy5hNC2 n3OeIhVTnRxcfwo9E/CQ/YUxm2g/qNqzUauU/DZp1L3PHQ25uV/IRt+DElhagIZMyb/3 sfjdVJI504U9Fpxy5WSP2ZYbnqJAhadQreHD4BA1D7fcn5nHNHTXjrR8YQUIZ3XUT+Kx mYkQ== 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:date:subject:cc:to:from; bh=xvOxnLb9YOaY1QRe0cpFg5tB+I0EnJ9OPuOhc5Jge60=; b=cxdW1TN6C4+mtsXKkl2UCUPSFYXXPhMeoxlBBEeuwRhdhOww6BhASy0zJnnP/xafVn IJG2QM6tJj4ckSMFjWdpg3IbT+zjJd1EY+ORKLRQqCye4QJTE6GJgA4dTYzoRZCfH6wn FDoA1QWeSShI9VneGwzyOOptgdOurIyXK52pJifRCQpjhyylxLSV1oTEPBtm34s7FUfa mHtAR0wqOHZX3W4vrLFABG16+k/MqveG/CM+OB5ip1b8dxNhV0YvMsQR0OVrtdHQ9DvC v5Ta15jOoSRR6qm+blrHGQOOhcIkE2vm9iwQq91PnpDa4gWyJp2xqI6/PCb41QKWvMB+ AegA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e27-20020a056102035b00b0042c4639cb05si963932vsa.808.2023.04.14.07.03.24; Fri, 14 Apr 2023 07:03:43 -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 S230146AbjDNOBr (ORCPT + 99 others); Fri, 14 Apr 2023 10:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbjDNOBl (ORCPT ); Fri, 14 Apr 2023 10:01:41 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95FABB440; Fri, 14 Apr 2023 07:01:16 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 6fe70f731cfbdbc4; Fri, 14 Apr 2023 16:00:49 +0200 Received: from kreacher.localnet (unknown [213.134.188.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id CD86681B369; Fri, 14 Apr 2023 16:00:48 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Hans de Goede Subject: [PATCH v1] ACPI: bus: Ensure that notify handlers are not running after removal Date: Fri, 14 Apr 2023 16:00:48 +0200 Message-ID: <5688433.DvuYhMxLoT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.188.177 X-CLIENT-HOSTNAME: 213.134.188.177 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeltddgjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepffffffekgfehheffleetieevfeefvefhleetjedvvdeijeejledvieehueevueffnecukfhppedvudefrddufeegrddukeekrddujeejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekkedrudejjedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepfedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhuggvghhovgguvgesrhgvughhrghtrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Rafael J. Wysocki Currently, acpi_device_remove_notify_handler() may return while the notify handler being removed is still running which may allow the module holding that handler to be torn down prematurely. Address this issue by making acpi_device_remove_notify_handler() wait for the handling of all the ACPI events in progress to complete before returning. Fixes: 5894b0c46e49 ("ACPI / scan: Move bus operations and notification routines to bus.c") Signed-off-by: Rafael J. Wysocki --- drivers/acpi/bus.c | 1 + 1 file changed, 1 insertion(+) Index: linux-pm/drivers/acpi/bus.c =================================================================== --- linux-pm.orig/drivers/acpi/bus.c +++ linux-pm/drivers/acpi/bus.c @@ -589,6 +589,7 @@ static void acpi_device_remove_notify_ha acpi_remove_notify_handler(device->handle, type, acpi_notify_device); } + acpi_os_wait_events_complete(); } /* Handle events targeting \_SB device (at present only graceful shutdown) */