Message ID | E1YZ0b8-0000ss-Nq@rmk-PC.arm.linux.org.uk (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Rafael Wysocki |
Headers | show |
On 20 March 2015 at 18:20, Russell King <rmk+kernel@arm.linux.org.uk> wrote: > pm_genpd_remove_device() tries hard to validate the generic PM domain > passed to it, but the validation is not complete. > > dev->pm_domain contains a struct dev_pm_domain, which is the "base > class" of generic PM domains. Other users of dev_pm_domains include > stuff like vga_switheroo. Hence, a device could have a generic PM > domain or a vga_switcheroo PM domain in dev->pm_domain. > > We need ot be certain that the PM domain is actually valid before we > try to remove it. We can do this easily as we have a way to get the > current validated generic PM domain for a struct device. This must > match the generic PM domain being requested for removal. > > Convert the code to use this alternative validation method instead. > > Acked-by: Kevin Hilman <khilman@linaro.org> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > drivers/base/power/domain.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 89d2eea7f561..5f560fa45a32 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -1538,9 +1538,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, > > dev_dbg(dev, "%s()\n", __func__); > > - if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(dev) > - || IS_ERR_OR_NULL(dev->pm_domain) > - || pd_to_genpd(dev->pm_domain) != genpd) > + if (!genpd || genpd != pm_genpd_lookup_dev(dev)) > return -EINVAL; > > genpd_acquire_lock(genpd); > -- > 1.8.3.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 89d2eea7f561..5f560fa45a32 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1538,9 +1538,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, dev_dbg(dev, "%s()\n", __func__); - if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(dev) - || IS_ERR_OR_NULL(dev->pm_domain) - || pd_to_genpd(dev->pm_domain) != genpd) + if (!genpd || genpd != pm_genpd_lookup_dev(dev)) return -EINVAL; genpd_acquire_lock(genpd);