Commit 1024e69
opp: Prevent memory leak in dev_pm_opp_attach_genpd()
[ Upstream commit cb60e96 ]
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU
sharing the table), then it would result in unwanted behavior like
memory leak, attaching the domain multiple times, etc.
Handle that by checking and returning earlier if the domains are already
attached. Now that dev_pm_opp_detach_genpd() can get called multiple
times as well, we need to protect that too.
Note that the virtual device pointers aren't returned in this case, as
they may become unavailable to some callers during the middle of the
operation.
Reported-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 27e52f1 commit 1024e69
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1949 | 1949 | | |
1950 | 1950 | | |
1951 | 1951 | | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
1952 | 1955 | | |
1953 | 1956 | | |
1954 | 1957 | | |
| |||
1995 | 1998 | | |
1996 | 1999 | | |
1997 | 2000 | | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
1998 | 2004 | | |
1999 | 2005 | | |
2000 | 2006 | | |
| |||
0 commit comments