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 C48882957CD for ; Thu, 20 Nov 2025 16:29:44 +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=1763656184; cv=none; b=boCP33UNkEpj1JCSwgkO1SI9PAFlgiZK8GnEkSAO5MbaMMH9bdc4gsf02+wOcM+JzQgY/gXell8Y8J6dGtlROrh/ZDQpHSdFfmfecZJs/eQV01TNnDnyotBIS5KM3eLnQJvPC+iy3AhkO8zaCN1oTgqFFj9KM9TnGVa/iG0wddo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763656184; c=relaxed/simple; bh=0AdwIRDiCYMNoTzJgI6ygo3d82f6j93h16StzhtIWlo=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=IT+jgvICKlZPlGDtZSJZ2PyPoJcbeMHWABqg+EJDXxuvMbsJp2uQUNOGCfxpmVty7pVyCwAevWif65F1WgaLuyyn3N/XlF0Wn1dlHCSnZG6AvbIPtcpXr7DHnTtg6Z5WC5APR9JAYgoSECgqp5U/0RS+f1PWxYRN0L/Mqq7wDx4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JxaX+ddv; 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="JxaX+ddv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF4FC4CEF1; Thu, 20 Nov 2025 16:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763656184; bh=0AdwIRDiCYMNoTzJgI6ygo3d82f6j93h16StzhtIWlo=; h=Subject:To:Cc:From:Date:From; b=JxaX+ddvHq4TliRZhkX+swHK91yJ7YZirg/JWD/J1He8tgfLwISNuFnzGvFGeD+WD WRhH3RaA5gfVH6bvjtvQ9V532wrzqHQ+L18cJNOqohdYKbug932Y15GcD9Rc/oL6Gm cYjHSSIbN9dUaR8kRmm0kASiN++pn1RbxENtz5hY= Subject: FAILED: patch "[PATCH] pmdomain: samsung: plug potential memleak during probe" failed to apply to 5.15-stable tree To: andre.draszik@linaro.org,krzysztof.kozlowski@linaro.org,m.szyprowski@samsung.com,peter.griffin@linaro.org,ulf.hansson@linaro.org Cc: From: Date: Thu, 20 Nov 2025 17:29:34 +0100 Message-ID: <2025112034-headgear-rug-fcf9@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 90c82941adf1986364e0f82c35cf59f2bf5f6a1d # git commit -s git send-email --to '' --in-reply-to '2025112034-headgear-rug-fcf9@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 90c82941adf1986364e0f82c35cf59f2bf5f6a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Draszik?= Date: Thu, 16 Oct 2025 16:58:37 +0100 Subject: [PATCH] pmdomain: samsung: plug potential memleak during probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit of_genpd_add_provider_simple() could fail, in which case this code leaks the domain name, pd->pd.name. Use devm_kstrdup_const() to plug this leak. As a side-effect, we can simplify existing error handling. Fixes: c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular platform driver") Cc: stable@vger.kernel.org Reviewed-by: Peter Griffin Reviewed-by: Krzysztof Kozlowski Signed-off-by: André Draszik Tested-by: Marek Szyprowski Signed-off-by: Ulf Hansson diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c index 5d478bb37ad6..f53e1bd24798 100644 --- a/drivers/pmdomain/samsung/exynos-pm-domains.c +++ b/drivers/pmdomain/samsung/exynos-pm-domains.c @@ -92,13 +92,14 @@ static const struct of_device_id exynos_pm_domain_of_match[] = { { }, }; -static const char *exynos_get_domain_name(struct device_node *node) +static const char *exynos_get_domain_name(struct device *dev, + struct device_node *node) { const char *name; if (of_property_read_string(node, "label", &name) < 0) name = kbasename(node->full_name); - return kstrdup_const(name, GFP_KERNEL); + return devm_kstrdup_const(dev, name, GFP_KERNEL); } static int exynos_pd_probe(struct platform_device *pdev) @@ -115,15 +116,13 @@ static int exynos_pd_probe(struct platform_device *pdev) if (!pd) return -ENOMEM; - pd->pd.name = exynos_get_domain_name(np); + pd->pd.name = exynos_get_domain_name(dev, np); if (!pd->pd.name) return -ENOMEM; pd->base = of_iomap(np, 0); - if (!pd->base) { - kfree_const(pd->pd.name); + if (!pd->base) return -ENODEV; - } pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on;