From: thomas.lendacky@amd.com (Tom Lendacky)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] crypto: Fully restore ahash request before completing
Date: Fri, 3 Jan 2014 09:10:30 -0600 [thread overview]
Message-ID: <10214668.cztjge9Iie@tlendack-t1> (raw)
In-Reply-To: <20131230090112.GA8550@gondor.apana.org.au>
On Monday, December 30, 2013 05:01:13 PM Herbert Xu wrote:
> On Fri, Dec 27, 2013 at 01:21:36AM +0100, Marek Vasut wrote:
> >
> > > > - complete(data, err);
> > > > + areq->base.complete = complete;
> > > > + areq->base.data = data;
> > > > +
> > > > + complete(&areq->base, err);
> > >
> > > This looks completely bogus. While restoring areq isn't wrong per
> > > se, calling complete with &areq->base makes no sense. The original
> > > completion data is in the variable "data".
> >
> > Is there some documentation for this so I can understand why this is wrong,
> > please? I really don't quite get it, sorry. Actually, is there some
> > documentation for writing crypto API drivers at all please ?
>
> Well it's wrong because the completion function (req->base.complete)
> is meant to take data (req->base.data) as its first argument. So
> giving it a pointer to req->base makes no sense.
>
The crypto_completion_t typdef is defined as:
typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
so I believe &areq->base is the proper first argument (which is actually just
the req parameter on the ahash_op_unaligned_done function).
If you are going to restore areq, you really should restore all fields that
were changed - result, base.complete, base.data - and set priv to NULL.
Since the ahash_request_priv structure is freed in ahash_op_unaligned_finish
you'll need to save the value of priv->result in order to restore areq->result
(u8 *result = priv->result; or similar).
Additionally, you should probably also fix up ahash_def_finup_done2 and
ahash_def_finup_done1.
Thanks,
Tom
> Cheers,
>
next prev parent reply other threads:[~2014-01-03 15:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-10 19:26 [PATCH 1/5] crypto: Fully restore ahash request before completing Marek Vasut
2013-12-10 19:26 ` [PATCH V2 2/5] crypto: mxs: Remove the old DCP driver Marek Vasut
2013-12-10 19:26 ` [PATCH V3 3/5] crypto: mxs: Add Freescale MXS " Marek Vasut
2013-12-10 19:26 ` [PATCH 4/5] ARM: mxs: dts: Enable DCP for MXS Marek Vasut
2013-12-10 19:26 ` [PATCH V2 5/5] crypto: Sort drivers/crypto/Makefile Marek Vasut
2013-12-20 12:04 ` [PATCH 1/5] crypto: Fully restore ahash request before completing Herbert Xu
2013-12-27 0:21 ` Marek Vasut
2013-12-30 9:01 ` Herbert Xu
2014-01-03 15:10 ` Tom Lendacky [this message]
2014-01-03 22:33 ` Herbert Xu
2014-01-04 7:20 ` Marek Vasut
2014-01-05 13:05 ` Herbert Xu
2014-01-05 15:33 ` Marek Vasut
2014-01-05 23:29 ` Herbert Xu
2014-01-14 17:34 ` Marek Vasut
-- strict thread matches above, loose matches on Subject: below --
2013-12-01 21:20 Marek Vasut
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=10214668.cztjge9Iie@tlendack-t1 \
--to=thomas.lendacky@amd.com \
--cc=linux-arm-kernel@lists.infradead.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