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 2EBA1611A for ; Sun, 28 May 2023 19:22:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 970CAC433EF; Sun, 28 May 2023 19:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1685301746; bh=m6IicWYJbA8WZ0Ph0v90Z/lZ89/fuwHRQZAHU11yivA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GAxExdQBWRp8FuWYNvkEG2GdtnZSNFZs4UrgEcFs5sks144LPyh5laY+yksktv1gy jqRbwf1kqMkqLNANjnyLi6GkdGMDtFvg2PQKaa+BmCSTdJWuHDJMesE/QEqP5vGJSt qMtqlqYKRfWCEYjizj34bTuSsd864PeWtJIOUQJg= 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.4 020/161] ACPI: EC: Fix oops when removing custom query handlers Date: Sun, 28 May 2023 20:09:04 +0100 Message-Id: <20230528190837.789464552@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528190837.051205996@linuxfoundation.org> References: <20230528190837.051205996@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 defc5796b5084..c7baccd47b89f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1118,6 +1118,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