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 2152A32C94B; Fri, 17 Oct 2025 15:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760714410; cv=none; b=n1v66mEStWoudMIG7YDyqTSdDCEqgTgj6XipXqXz00hs6u7Q68PnGDhxbZuFrfnIIpYHnG25qYh/hpzdPtkfGQqYPPmnArMVFb6njqIVZbNqOaAeodjqL2KZI95LWDJds+ugV+71v619fGKeeeq89Tpot2WnxQnTPbZjTD4Z2ls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760714410; c=relaxed/simple; bh=rb9R45WJ6T0aAWr/Jqe/ubdXbZL3XRdJ32M4sXP8rrg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OLsWDK0LZ+lcpsqTA4OMzYRnLvwX4bk0z7UhKKYH7i5tQ6gZu7iYzkEyxl2HT1gA+aRXCGUfaTWAynlZedqeqw2BszYGi9U7Beveb/KcLWfFEBx07IV/DeQSf34xIXUNVIDZr8eHblClXummOjy1H1k5nE2RXescU9zqdfbGWmg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IP9Vq0ox; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IP9Vq0ox" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99E16C4CEE7; Fri, 17 Oct 2025 15:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760714410; bh=rb9R45WJ6T0aAWr/Jqe/ubdXbZL3XRdJ32M4sXP8rrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IP9Vq0oxot7m7jA08vsB2RtZEol2bYLyVv7ZyZrHS6nysM+7+vwU0jNU3lTnW3A8V JqQSPBXsh5rMozpSpomPnhprHrsbozlWUiGzjgMBTCnbapNF2t/0Hf0FZ0v7HJwZ1/ yVwPmXSkFbFfht7yJRuSWO/8Wi4XG/YPSv+CR9Zw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Carlo Caione , Johan Hovold , Martin Blumenstingl , Neil Armstrong Subject: [PATCH 6.12 102/277] firmware: meson_sm: fix device leak at probe Date: Fri, 17 Oct 2025 16:51:49 +0200 Message-ID: <20251017145150.855550909@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145147.138822285@linuxfoundation.org> References: <20251017145147.138822285@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: Johan Hovold commit 8ece3173f87df03935906d0c612c2aeda9db92ca upstream. Make sure to drop the reference to the secure monitor device taken by of_find_device_by_node() when looking up its driver data on behalf of other drivers (e.g. during probe). Note that holding a reference to the platform device does not prevent its driver data from going away so there is no point in keeping the reference after the helper returns. Fixes: 8cde3c2153e8 ("firmware: meson_sm: Rework driver as a proper platform driver") Cc: stable@vger.kernel.org # 5.5 Cc: Carlo Caione Signed-off-by: Johan Hovold Acked-by: Martin Blumenstingl Link: https://lore.kernel.org/r/20250725074019.8765-1-johan@kernel.org Signed-off-by: Neil Armstrong Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/meson/meson_sm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/firmware/meson/meson_sm.c +++ b/drivers/firmware/meson/meson_sm.c @@ -232,11 +232,16 @@ EXPORT_SYMBOL(meson_sm_call_write); struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node) { struct platform_device *pdev = of_find_device_by_node(sm_node); + struct meson_sm_firmware *fw; if (!pdev) return NULL; - return platform_get_drvdata(pdev); + fw = platform_get_drvdata(pdev); + + put_device(&pdev->dev); + + return fw; } EXPORT_SYMBOL_GPL(meson_sm_get);