Patch "PM: domains: Move the verification of in-params from genpd_add_device()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PM: domains: Move the verification of in-params from genpd_add_device()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pm-domains-move-the-verification-of-in-params-from-g.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit df0457f3c7f97694a995e734d682785b6b8d3df4
Author: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
Date:   Tue May 30 11:55:36 2023 +0200

    PM: domains: Move the verification of in-params from genpd_add_device()
    
    [ Upstream commit 4384a70c8813e8573d1841fd94eee873f80a7e1a ]
    
    Commit f38d1a6d0025 ("PM: domains: Allocate governor data dynamically
    based on a genpd governor") started to use the in-parameters in
    genpd_add_device(), without first doing a verification of them.
    
    This isn't really a big problem, as most callers do a verification already.
    
    Therefore, let's drop the verification from genpd_add_device() and make
    sure all the callers take care of it instead.
    
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Fixes: f38d1a6d0025 ("PM: domains: Allocate governor data dynamically based on a genpd governor")
    Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index b33fc322e0928..56ceba4698024 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1624,9 +1624,6 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
 
 	dev_dbg(dev, "%s()\n", __func__);
 
-	if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(dev))
-		return -EINVAL;
-
 	gpd_data = genpd_alloc_dev_data(dev, gd);
 	if (IS_ERR(gpd_data))
 		return PTR_ERR(gpd_data);
@@ -1668,6 +1665,9 @@ int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev)
 {
 	int ret;
 
+	if (!genpd || !dev)
+		return -EINVAL;
+
 	mutex_lock(&gpd_list_lock);
 	ret = genpd_add_device(genpd, dev, dev);
 	mutex_unlock(&gpd_list_lock);
@@ -2514,6 +2514,9 @@ int of_genpd_add_device(struct of_phandle_args *genpdspec, struct device *dev)
 	struct generic_pm_domain *genpd;
 	int ret;
 
+	if (!dev)
+		return -EINVAL;
+
 	mutex_lock(&gpd_list_lock);
 
 	genpd = genpd_get_from_provider(genpdspec);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux