From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381664; b=UuloW5Qozi50joHT3+GTOst0EoOCgFZm7XMok0h3phAIEjTnLmu7QAx72HbB+OPzb9lk z5NDp8u6UjoRD9sahFouBL2kV6SlfHK07yt4BNlV4X2RV02XGao+mFQWyPGpp4nPd/yTN wYZyaJsDef0ncQxGt29ewNwyF7EDKRr5QRnaCdphK8hLR+80K1SGxr6yLSwGx1V9tXlDI MPcr/uhPfy+eYi1zjiQayXCWAMfcVhlub5tS8cEMth/JazS9VI8ycsXqvsNlWMN/aR+dT xUYAZUV0JkxlVs9OHqthxMUgjS4KcOKiodHn7/dVi+bIfeXfD8n+JFwdoSmxNZdBmEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381664; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=vdGaAYrrwqHPd2uD4FuUzz8mm7/mOOzfY/rRsedtvN4=; b=EuevUAcYJ6fxeny6wxR2Yt5ZogOEqCPBvVj1eeNt5qJT9amdjwsPJS/9V/rNDYUu/XSe 0/CjpP83EZwVZii9W0/rLIi3aVL8CzcHlYh0fOoO6rxZ8UF81/rH5tEMdh/j1gVJnNyaW DNOvyNJRsluTMe+e6IWlNEet2kkTxNSPO+NohtKBGvERXuqbfulM8ih6OKUsEV7bVWyqy nmsW3JNoF+5SzEI++LYKgjc7tmPmW97exRXvt0kyuRWqGfg170K2zouNlViUp1pASj21d 5fmWqV1naPo1TL9p8ck4yuPyx0ZS3//hOfEIZnrMg6ohcwEOIZ6Q0ERJmPLjLHosh3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=l7QmdaHY; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C43E6606A322; Fri, 4 Dec 2026 10:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=l7QmdaHY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F17E1F000CE; Fri, 4 Dec 2026 10:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381664; bh=vdGaAYrrwqHPd2uD4FuUzz8mm7/mOOzfY/rRsedtvN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=l7QmdaHYrjWPenQWRkz3LNL8kc5Z+g5ppKDhJoDsYESI84KZDOiFZNApzZ37wiIjV PllJjbuEM0IToyu1+/Q7NRUNOqAs6sDycasjD/Lbll+hczG8TH2GVP+SdciuXyyv36 q+aRwnZJJRoetPUzQYzyZXDl3dxAzSJAijPi1FyI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Peng Fan , Sudeep Holla , Sasha Levin Subject: [PATCH 6.18 121/703] firmware: arm_scmi: Unregister notifier on enable failure Date: Fri, 4 Dec 2026 19:00:20 +0900 Message-ID: <20261204100631.020465671@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudeep Holla [ Upstream commit b9bb2eb88037a3823e7abd096b54d0a07d428f90 ] scmi_notifier_register() adds the caller's notifier block before enabling the corresponding event at the platform. If enablement fails, the caller receives an error and can free its notifier block. A concurrent registration can retain and later enable the handler, leaving the failed caller's block in its notification chain. Event delivery can then dereference the freed block. Remove the notifier block before dropping the handler reference when event enablement fails. Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-c3c9437c-ba1a-4db6-837f-cb0950d89018 Fixes: e7c215f358a3 ("firmware: arm_scmi: Add notification callbacks-registration") Reviewed-by: Peng Fan Link: https://patch.msgid.link/20261028130502.2999676-3-sudeep.holla@kernel.org Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/notify.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c index 672c91197a68a..ee2fc0549508c 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -1399,8 +1399,10 @@ static int scmi_notifier_register(const struct scmi_handle *handle, /* Enable events for not pending handlers */ if (!IS_HNDL_PENDING(hndl)) { ret = scmi_event_handler_enable_events(hndl); - if (ret) + if (ret) { + blocking_notifier_chain_unregister(&hndl->chain, nb); scmi_put_handler(ni, hndl); + } } return ret; -- 2.53.0