From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7925C611B for ; Sun, 28 May 2023 19:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF81FC433D2; Sun, 28 May 2023 19:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685302816; bh=d2iGA6U1G93m7fcgvIrolP/V/MrOkik0/FSmaX4JwkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIES2t52Ib329q7xWc58FfKRxqWltL9Aqw0HDNeEtL+NtQZTsAmWi8lJjCh06k9N4 KkOrg/Y0I/d/C5bX/QVYDjBVBdKwPNjv61oNmREihV8pRTEXHrghfrCnPCAJUSWSPX jPmaorH0snjlhpUPm4KoY9Jl1JeD6gGQycYbLodw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Armin Wolf , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10 038/211] ACPI: EC: Fix oops when removing custom query handlers Date: Sun, 28 May 2023 20:09:19 +0100 Message-Id: <20230528190844.490565683@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528190843.514829708@linuxfoundation.org> References: <20230528190843.514829708@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Armin Wolf [ Upstream commit e5b492c6bb900fcf9722e05f4a10924410e170c1 ] When removing custom query handlers, the handler might still be used inside the EC query workqueue, causing a kernel oops if the module holding the callback function was already unloaded. Fix this by flushing the EC query workqueue when removing custom query handlers. Tested on a Acer Travelmate 4002WLMi Signed-off-by: Armin Wolf Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/ec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 4707d1808ca54..487884420fb0d 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1114,6 +1114,7 @@ static void acpi_ec_remove_query_handlers(struct acpi_ec *ec, void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) { acpi_ec_remove_query_handlers(ec, false, query_bit); + flush_workqueue(ec_query_wq); } EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); -- 2.39.2