From: "Pali Rohár" <pali.rohar@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Benoît Cousson" <bcousson@baylibre.com>,
"Tony Lindgren" <tony@atomide.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Russell King" <linux@arm.linux.org.uk>,
"Paul Walmsley" <paul@pwsan.com>,
"David S. Miller" <davem@davemloft.net>,
linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
"Pavel Machek" <pavel@ucw.cz>, "Nishanth Menon" <nm@ti.com>,
"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
"Aaro Koskinen" <aaro.koskinen@iki.fi>,
"Sebastian Reichel" <sre@kernel.org>
Subject: Re: [PATCH v2] crypto: omap-sham: Check for return value from pm_runtime_get_sync
Date: Thu, 14 May 2015 23:40:37 +0200 [thread overview]
Message-ID: <201505142340.37649@pali> (raw)
In-Reply-To: <1425808861-17004-1-git-send-email-pali.rohar@gmail.com>
[-- Attachment #1: Type: Text/Plain, Size: 2161 bytes --]
On Sunday 08 March 2015 11:01:01 Pali Rohár wrote:
> Function pm_runtime_get_sync could fail and we need to check return
> value to prevent kernel crash.
>
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> ---
> v2: Check return value for all pm_runtime_get_sync() calls
> ---
> drivers/crypto/omap-sham.c | 23 ++++++++++++++++++++---
> 1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
> index b20e374..c5df53d 100644
> --- a/drivers/crypto/omap-sham.c
> +++ b/drivers/crypto/omap-sham.c
> @@ -362,7 +362,13 @@ static void omap_sham_copy_ready_hash(struct
> ahash_request *req)
>
> static int omap_sham_hw_init(struct omap_sham_dev *dd)
> {
> - pm_runtime_get_sync(dd->dev);
> + int err;
> +
> + err = pm_runtime_get_sync(dd->dev);
> + if (err < 0) {
> + dev_err(dd->dev, "failed to get sync: %d\n", err);
> + return err;
> + }
>
> if (!test_bit(FLAGS_INIT, &dd->flags)) {
> set_bit(FLAGS_INIT, &dd->flags);
> @@ -1949,7 +1955,13 @@ static int omap_sham_probe(struct
> platform_device *pdev) dd->flags |= dd->pdata->flags;
>
> pm_runtime_enable(dev);
> - pm_runtime_get_sync(dev);
> +
> + err = pm_runtime_get_sync(dev);
> + if (err < 0) {
> + dev_err(dev, "failed to get sync: %d\n", err);
> + goto err_pm;
> + }
> +
> rev = omap_sham_read(dd, SHA_REG_REV(dd));
> pm_runtime_put_sync(&pdev->dev);
>
> @@ -1979,6 +1991,7 @@ err_algs:
> for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--)
> crypto_unregister_ahash(
> &dd->pdata->algs_info[i].algs_list[j]);
> +err_pm:
> pm_runtime_disable(dev);
> if (dd->dma_lch)
> dma_release_channel(dd->dma_lch);
> @@ -2021,7 +2034,11 @@ static int omap_sham_suspend(struct device
> *dev)
>
> static int omap_sham_resume(struct device *dev)
> {
> - pm_runtime_get_sync(dev);
> + int err = pm_runtime_get_sync(dev);
> + if (err < 0) {
> + dev_err(dev, "failed to get sync: %d\n", err);
> + return err;
> + }
> return 0;
> }
> #endif
Herbert, can you apply this patch?
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2015-05-14 21:40 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 13:49 [PATCH 00/10] omap3 crypto fixes Pali Rohár
2015-02-26 13:49 ` [PATCH 01/10] ARM: OMAP2+: Return correct error values from device and hwmod Pali Rohár
2015-05-21 11:44 ` Pali Rohár
2015-02-26 13:49 ` [PATCH 02/10] ARM: OMAP3: Fix crypto support for HS devices Pali Rohár
2015-02-28 16:24 ` Pavel Machek
2015-05-26 10:54 ` Pali Rohár
2015-05-26 10:54 ` Pali Rohár
2015-06-02 18:36 ` Paul Walmsley
2015-02-26 13:49 ` [PATCH 03/10] crypto: omap-sham: Add support for omap3 devices Pali Rohár
[not found] ` <1424958600-18881-4-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:25 ` Pavel Machek
2015-02-28 16:25 ` Pavel Machek
2015-05-15 9:19 ` Pali Rohár
2015-05-15 9:19 ` Pali Rohár
2015-05-18 4:30 ` Herbert Xu
2015-05-18 4:30 ` Herbert Xu
2015-02-26 13:49 ` [PATCH 04/10] crypto: omap-sham: Check for return value from pm_runtime_get_sync Pali Rohár
2015-02-28 16:39 ` Pavel Machek
2015-03-08 10:01 ` [PATCH v2] " Pali Rohár
2015-03-09 20:52 ` Pavel Machek
2015-05-14 21:40 ` Pali Rohár [this message]
2015-05-15 0:15 ` Herbert Xu
2015-05-15 7:02 ` Herbert Xu
2015-05-15 9:20 ` Pali Rohár
2015-02-26 13:49 ` [PATCH 05/10] ARM: dts: omap3 hs: Remove timer12 Pali Rohár
2015-02-28 16:54 ` Pavel Machek
2015-02-26 13:49 ` [PATCH 06/10] ARM: dts: omap3: Add missing dmas for crypto Pali Rohár
[not found] ` <1424958600-18881-7-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:46 ` Pavel Machek
2015-02-28 16:46 ` Pavel Machek
2015-03-16 21:44 ` Tony Lindgren
2015-02-26 13:49 ` [PATCH 07/10] ARM: dts: n9/n950: Enable omap crypto support Pali Rohár
2015-02-26 13:49 ` Pali Rohár
2015-02-27 15:43 ` Tony Lindgren
2015-02-27 16:01 ` Pali Rohár
2015-02-27 16:10 ` Tony Lindgren
2015-02-27 16:10 ` Tony Lindgren
2015-02-28 16:41 ` Pavel Machek
2015-03-19 16:43 ` Tony Lindgren
2015-03-19 16:43 ` Tony Lindgren
2015-02-26 13:49 ` [PATCH 08/10] ARM: dts: n900: Enable omap sham and include directly omap34xx.dtsi Pali Rohár
2015-02-28 16:44 ` Pavel Machek
2015-02-26 13:49 ` [PATCH 09/10] ARM: dts: omap3-tao3530: Include " Pali Rohár
2015-02-28 16:44 ` Pavel Machek
2015-02-26 13:50 ` [PATCH 10/10] ARM: dts: Remove files omap34xx-hs.dtsi and omap36xx-hs.dtsi Pali Rohár
[not found] ` <1424958600-18881-11-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:45 ` Pavel Machek
2015-02-28 16:45 ` Pavel Machek
2015-02-26 22:46 ` [PATCH 00/10] omap3 crypto fixes Aaro Koskinen
2015-02-27 12:40 ` Pali Rohár
2015-03-07 23:19 ` Aaro Koskinen
2015-03-07 23:19 ` Aaro Koskinen
2015-03-06 18:36 ` Tony Lindgren
2015-03-06 18:36 ` Tony Lindgren
[not found] ` <20150306183631.GA13520-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-03-06 19:16 ` Pali Rohár
2015-03-06 19:16 ` Pali Rohár
2015-03-06 19:18 ` Tony Lindgren
2015-03-06 22:23 ` Aaro Koskinen
[not found] ` <20150306222306.GB587-+UqvGBo8NkiJ/SmVcN9c7yH8jP4CeeTLqBW4ids5wwA@public.gmane.org>
2015-03-08 10:01 ` Pali Rohár
2015-03-08 10:01 ` Pali Rohár
2015-03-08 16:35 ` Paul Walmsley
2015-03-08 16:35 ` Paul Walmsley
2015-03-15 9:59 ` Pali Rohár
2015-05-14 21:17 ` Pali Rohár
2015-05-14 21:34 ` Tony Lindgren
[not found] ` <20150514213418.GP15563-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-05-14 21:39 ` Pali Rohár
2015-05-14 21:39 ` Pali Rohár
2015-05-14 22:03 ` Tony Lindgren
2015-05-14 22:03 ` Tony Lindgren
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=201505142340.37649@pali \
--to=pali.rohar@gmail.com \
--cc=aaro.koskinen@iki.fi \
--cc=bcousson@baylibre.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=tony@atomide.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.