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 6DC071448E7 for ; Mon, 29 Jul 2024 10:51:26 +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=1722250286; cv=none; b=d8IbwptIfGwXPy+YewhXwjqqoEryLF60avkR2mALQjpwIepXhYuuYFrNXMpXU1RDBN9krOoqQ/WKMjodYcCeJJqvKBHFr7Ava0HKiHRCW0xqlhHBj/v/TO4c7tTrmV6kFXrPSxc9DwlvpRKdfEjADjLmrKOq3V4CffdcAcveWUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722250286; c=relaxed/simple; bh=xEpS1E6USrzb3UNkDkQXAf6mXFjaNs9Xecvg06oxTqk=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=t1XBvBBiJh+HGU8xeppdm45uRbMAJkQIP60eFsSNzQnD1kRhvXTd6OflVAwGw9T8+dC/6lpFRtGLQOc0r/RsSqoQy4MSQ493SGpvEmcyPxx2uixm7UPKM8DZT9zfMrN4L4Y0gmzR+7Tk6rezGjIkzU/OgCRLs8yOYQET3mH+/2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=04zUHggM; 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="04zUHggM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CFB2C4AF0A; Mon, 29 Jul 2024 10:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722250286; bh=xEpS1E6USrzb3UNkDkQXAf6mXFjaNs9Xecvg06oxTqk=; h=Subject:To:Cc:From:Date:From; b=04zUHggMKuOQHYoOI9+EaIEgkVYz3r2t6tPgccWpCF2V1TlcZi/cOPIYIWN00JmP4 kq2z8hv7jUJvKj5fqZXsQASJvN5PAh332KgTzn6IdNF5K0xmUML3VZiGb/bcF/VIdV kjNr5rzn8p/RpkNlbqpildx7XMqfSqRj6l+FtPd4= Subject: FAILED: patch "[PATCH] cpufreq: qcom-nvmem: fix memory leaks in probe error paths" failed to apply to 5.10-stable tree To: javier.carrasco.cruz@gmail.com,viresh.kumar@linaro.org Cc: From: Date: Mon, 29 Jul 2024 12:51:17 +0200 Message-ID: <2024072917-chivalry-timid-afc3@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=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-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.10.y git checkout FETCH_HEAD git cherry-pick -x d01c84b97f19f1137211e90b0a910289a560019e # git commit -s git send-email --to '' --in-reply-to '2024072917-chivalry-timid-afc3@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: d01c84b97f19 ("cpufreq: qcom-nvmem: fix memory leaks in probe error paths") 2a5d46c3ad6b ("cpufreq: qcom-nvmem: Simplify driver data allocation") 402732324b17 ("cpufreq: qcom-nvmem: Convert to platform remove callback returning void") d78be404f97f ("cpufreq: qcom-nvmem: Switch to use dev_err_probe() helper") 49cd000dc51b ("cpufreq: qcom-nvmem: Migrate to dev_pm_opp_set_config()") 2ff8fe13ac6d ("cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From d01c84b97f19f1137211e90b0a910289a560019e Mon Sep 17 00:00:00 2001 From: Javier Carrasco Date: Thu, 23 May 2024 23:24:59 +0200 Subject: [PATCH] cpufreq: qcom-nvmem: fix memory leaks in probe error paths The code refactoring added new error paths between the np device node allocation and the call to of_node_put(), which leads to memory leaks if any of those errors occur. Add the missing of_node_put() in the error paths that require it. Cc: stable@vger.kernel.org Fixes: 57f2f8b4aa0c ("cpufreq: qcom: Refactor the driver to make it easier to extend") Signed-off-by: Javier Carrasco Signed-off-by: Viresh Kumar diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index ea05d9d67490..5004e1dbc752 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -480,23 +480,30 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) drv = devm_kzalloc(&pdev->dev, struct_size(drv, cpus, num_possible_cpus()), GFP_KERNEL); - if (!drv) + if (!drv) { + of_node_put(np); return -ENOMEM; + } match = pdev->dev.platform_data; drv->data = match->data; - if (!drv->data) + if (!drv->data) { + of_node_put(np); return -ENODEV; + } if (drv->data->get_version) { speedbin_nvmem = of_nvmem_cell_get(np, NULL); - if (IS_ERR(speedbin_nvmem)) + if (IS_ERR(speedbin_nvmem)) { + of_node_put(np); return dev_err_probe(cpu_dev, PTR_ERR(speedbin_nvmem), "Could not get nvmem cell\n"); + } ret = drv->data->get_version(cpu_dev, speedbin_nvmem, &pvs_name, drv); if (ret) { + of_node_put(np); nvmem_cell_put(speedbin_nvmem); return ret; }