Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Zhang Qilong <zhangqilong3@huawei.com>,
	devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	paul.kocialkowski@bootlin.com, wens@csie.org, mchehab@kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming
Date: Mon, 2 Nov 2020 18:12:36 +0300	[thread overview]
Message-ID: <20201102151236.GD12347@kadam> (raw)
In-Reply-To: <20201102141838.7oicqkeqy7vy3ki3@gilmour.lan>

On Mon, Nov 02, 2020 at 03:18:38PM +0100, Maxime Ripard wrote:
> On Mon, Nov 02, 2020 at 10:26:22PM +0800, Zhang Qilong wrote:
> > pm_runtime_get_sync will increment pm usage counter even it
> > failed. Forgetting to pm_runtime_put_noidle will result in
> > reference leak in cedrus_start_streaming. We should fix it.
> > 
> > Fixes: d5aecd289babf ("media: cedrus: Implement runtime PM")
> > Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> 
> Shouldn't we fix pm_runtime_get_sync instead then? It seems that most of
> the callers get this wrong, and that's definitely non-obvious.
> 
> Maxime

The other bug that people run into is that pm_runtime_get_sync() can
return 1 on success.

drivers/spi/spi-img-spfi.c:734 img_spfi_resume() warn: pm_runtime_get_sync() also returns 1 on success
drivers/mfd/arizona-core.c:49 arizona_clk32k_enable() warn: pm_runtime_get_sync() also returns 1 on success
drivers/usb/dwc3/dwc3-pci.c:212 dwc3_pci_resume_work() warn: pm_runtime_get_sync() also returns 1 on success
drivers/input/keyboard/omap4-keypad.c:279 omap4_keypad_probe() warn: pm_runtime_get_sync() also returns 1 on success
drivers/gpu/drm/vc4/vc4_dsi.c:839 vc4_dsi_encoder_enable() warn: pm_runtime_get_sync() also returns 1 on success
drivers/gpu/drm/i915/selftests/mock_gem_device.c:157 mock_gem_device() warn: 'pm_runtime_get_sync(&pdev->dev)' returns positive and negative
drivers/watchdog/rti_wdt.c:230 rti_wdt_probe() warn: pm_runtime_get_sync() also returns 1 on success
drivers/media/platform/exynos4-is/mipi-csis.c:513 s5pcsis_s_stream() warn: pm_runtime_get_sync() also returns 1 on success
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c:89 mtk_vcodec_dec_pw_on() warn: pm_runtime_get_sync() also returns 1 on success
drivers/media/platform/ti-vpe/cal.c:794 cal_probe() warn: pm_runtime_get_sync() also returns 1 on success
drivers/media/platform/ti-vpe/vpe.c:2478 vpe_runtime_get() warn: pm_runtime_get_sync() also returns 1 on success
drivers/media/i2c/smiapp/smiapp-core.c:1529 smiapp_pm_get_init() warn: pm_runtime_get_sync() also returns 1 on success

I don't really understand the point of incrementing the counter on
failure well enough to write a check for this...

regards,
dan carpenter

  parent reply	other threads:[~2020-11-02 15:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 14:26 [PATCH -next] media: cedrus: fix reference leak in cedrus_start_streaming Zhang Qilong
2020-11-02 14:18 ` Maxime Ripard
2020-11-02 14:39   ` 答复: " zhangqilong
2020-11-02 15:12   ` Dan Carpenter [this message]
2020-11-04 11:39   ` Hans Verkuil
2020-11-05  8:06     ` 答复: " zhangqilong
2020-11-05 10:41     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102151236.GD12347@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=mchehab@kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=wens@csie.org \
    --cc=zhangqilong3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox