From: Heiner Kallweit <hkallweit1@gmail.com>
To: Shixin Liu <liushixin2@huawei.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>
Subject: crypto: stm32: Broken RPM changes should be reverted
Date: Sat, 27 Nov 2021 14:39:52 +0100 [thread overview]
Message-ID: <4239b61f-f8c5-462f-2951-fbba2dec8b1d@gmail.com> (raw)
When discussing whether pm_runtime_resume_and_get() should be annotated as
__must_check, I became aware of RPM usage in crypto/stm32.
Following two patches replace usage of pm_runtime_get_sync() with
pm_runtime_resume_and_get() w/o checking the return code.
747bf30fd944 ("crypto: stm32/cryp - Fix PM reference leak on stm32-cryp.c")
1cb3ad701970 ("crypto: stm32/hash - Fix PM reference leak on stm32-hash.c")
This results in RPM usage like the following in stm32_hash_export():
pm_runtime_resume_and_get(hdev->dev);
...
pm_runtime_mark_last_busy(hdev->dev);
pm_runtime_put_autosuspend(hdev->dev);
This is broken. After pm_runtime_resume_and_get() the usage count may be
incremented or not. If not, then the call to pm_runtime_put_autosuspend()
results in exactly the imbalance that the patch claims to fix.
Therefore I think both patches should be reverted, or the return code
of pm_runtime_resume_and_get() has to be checked and properly handled
in the driver logic.
next reply other threads:[~2021-11-27 13:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-27 13:39 Heiner Kallweit [this message]
2021-12-01 6:30 ` crypto: stm32 - Revert broken pm_runtime_resume_and_get changes Herbert Xu
2021-12-01 6:50 ` Heiner Kallweit
2021-12-01 14:46 ` Rafael J. Wysocki
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=4239b61f-f8c5-462f-2951-fbba2dec8b1d@gmail.com \
--to=hkallweit1@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-pm@vger.kernel.org \
--cc=liushixin2@huawei.com \
--cc=rafael@kernel.org \
/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