From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 284532F617C; Sat, 12 Sep 2026 12:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789215475; cv=none; b=r07acy7pEBIO0ypwX2Bf8qRlgSIbPU4hEX2zuNJxaZXkfb1klvfsP/rs41UYsYHhBVGtbUSQKfoHchvSzHe9GwFBvPqibTk+CJRDVKupsxZnyJwrkMd2qJoZvSNlO9iXL2GmwqVSTINURz+ReCgjfw/LgHRAOJ8/0YzBjmx3qCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789215475; c=relaxed/simple; bh=IxK4EKO7xvwf9JVOTvnWhdKLtjs9xXnN18VQ7aseZ4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jyjCt/MbnN+sMTWnoMfPJ0lIlFlFWl9Ci8+1aXT+LZKckx5Z5vQju7FtCfKJDkZ91Q4US47/Cz9BQT9+1hNMM/jxzEiaR2emcZwogO26TlTP7vZWYemKM0RgSLtFENYURaycPPyF4yhzNpy7G59wy5QunsP6O6yWbgTGVgFTACA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=o7ngLlOI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="o7ngLlOI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C26D41F000FF; Sat, 12 Sep 2026 12:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789215468; bh=VNUHD+RUnhtXZxfFvtyk2Ry5NAlPTNxzVM8bknCzE5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o7ngLlOIEo1LIE4vFE22AKZq2T3yqLNrzfxSuvpxTGQ/BUeoNF/FOLl3GGgfoxZdT MhWdP5JMIzI1Q+llALjbcpC7X0dpr2vFKhSozYGtQJ8NE2Xp/9RYk0r0kRJ83y3qOt mdR+df8ivm9Inbc37Ck0MZlBZfzU/cphyHM4kbno= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Sudeep Holla , Sasha Levin Subject: [PATCH 6.12 0538/1376] firmware: arm_scmi: Avoid IDR updates while cleaning channels Date: Sat, 12 Sep 2026 08:49:24 +0200 Message-ID: <20260912065619.533325231@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.535295758@linuxfoundation.org> References: <20260912065607.535295758@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudeep Holla [ Upstream commit c38b1e19485aaa820e52cfe162525a8af67563da ] scmi_cleanup_channels() walks the TX/RX channel IDRs with idr_for_each() to free transport resources and destroy the dedicated transport devices before calling idr_destroy(). The destroy callback removed each entry from the same IDR being walked. That is not needed for this cleanup path, and it is unsafe because idr_for_each() has not advanced its radix-tree iterator while the callback is running. Removing the current entry from the callback can invalidate the iterator state. The callback also cannot be protected by rcu_read_lock(), because scmi_device_destroy() may sleep. Leave IDR teardown to the following idr_destroy() call and keep the callback limited to device destruction. Fixes: 05a2801d8b90 ("firmware: arm_scmi: Use dedicated devices to initialize channels") Reported-by: Sashiko Link: https://patch.msgid.link/20260714-scmi_core_fixes-v6-6-3afe499d46e3@kernel.org Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index c0be4584397d3..0c30e2ddbd1e3 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2760,7 +2760,7 @@ static int scmi_channels_setup(struct scmi_info *info) return 0; } -static int scmi_chan_destroy(int id, void *p, void *idr) +static int scmi_chan_destroy(int id, void *p, void *data) { struct scmi_chan_info *cinfo = p; @@ -2773,8 +2773,6 @@ static int scmi_chan_destroy(int id, void *p, void *idr) cinfo->dev = NULL; } - idr_remove(idr, id); - return 0; } -- 2.53.0