lkml.org 
[lkml]   [2020]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 019/214] ASoC: tegra: Fix reference count leaks.
    Date
    From: Qiushi Wu <wu000273@umn.edu>

    [ Upstream commit deca195383a6085be62cb453079e03e04d618d6e ]

    Calling pm_runtime_get_sync increments the counter even in case of
    failure, causing incorrect ref count if pm_runtime_put is not called in
    error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails.

    Signed-off-by: Qiushi Wu <wu000273@umn.edu>
    Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
    Link: https://lore.kernel.org/r/20200613204422.24484-1-wu000273@umn.edu
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    sound/soc/tegra/tegra30_ahub.c | 4 +++-
    sound/soc/tegra/tegra30_i2s.c | 4 +++-
    2 files changed, 6 insertions(+), 2 deletions(-)

    diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
    index 635eacbd28d47..156e3b9d613c6 100644
    --- a/sound/soc/tegra/tegra30_ahub.c
    +++ b/sound/soc/tegra/tegra30_ahub.c
    @@ -643,8 +643,10 @@ static int tegra30_ahub_resume(struct device *dev)
    int ret;

    ret = pm_runtime_get_sync(dev);
    - if (ret < 0)
    + if (ret < 0) {
    + pm_runtime_put(dev);
    return ret;
    + }
    ret = regcache_sync(ahub->regmap_ahub);
    ret |= regcache_sync(ahub->regmap_apbif);
    pm_runtime_put(dev);
    diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
    index e6d548fa980b6..8894b7c16a01a 100644
    --- a/sound/soc/tegra/tegra30_i2s.c
    +++ b/sound/soc/tegra/tegra30_i2s.c
    @@ -538,8 +538,10 @@ static int tegra30_i2s_resume(struct device *dev)
    int ret;

    ret = pm_runtime_get_sync(dev);
    - if (ret < 0)
    + if (ret < 0) {
    + pm_runtime_put(dev);
    return ret;
    + }
    ret = regcache_sync(i2s->regmap);
    pm_runtime_put(dev);

    --
    2.25.1


    \
     
     \ /
      Last update: 2020-09-01 18:51    [W:4.056 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site