All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@free-electrons.com>
To: Kamil Konieczny <k.konieczny@partner.samsung.com>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	thomas.petazzoni@free-electrons.com,
	gregory.clement@free-electrons.com,
	miquel.raynal@free-electrons.com, oferh@marvell.com,
	igall@marvell.com, nadavh@marvell.com,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided
Date: Thu, 30 Nov 2017 15:30:51 +0100	[thread overview]
Message-ID: <20171130143051.GK30391@kwain> (raw)
In-Reply-To: <37f78e96-f7f7-2fde-25ac-7ae54a7a4217@partner.samsung.com>

Hi Kamil,

On Thu, Nov 30, 2017 at 03:10:28PM +0100, Kamil Konieczny wrote:
> On 30.11.2017 13:41, Antoine Tenart wrote:
> > 
> > No, if we do this we'll lose the ability to export the current state.
> 
> So maybe save it into request context:
> 
> 	result_sz = crypto_ahash_digestsize(ahash);
> 	ctx = ahash_request_ctx(areq);
> 
>   	if (sreq->finish)
>  		memcpy(sreq->state, areq->result, result_sz);
> 	else
> 		memcpy(sreq->state, ctx->state, result_sz);

Storing the digest into a driver own buffer could improve the export
ability in some *very rare* cases. If so I would suggest not to deal
with the kind of test you proposed, but to have your own buffer used
each time.

Anyway, this has nothing to do with the fix I'm proposing here, as it
would change the driver's logic, and would solve a complete different
(rare) issue.

The proposal here is to have a simple fix (which is similar to what can
be found in some other drivers), that can easily be backported to avoid
NULL pointer dereferences in older versions of the kernel.

Thanks,
Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-11-30 14:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 15:42 [PATCH v2 0/4] crypto: inside-secure - set of fixes Antoine Tenart
2017-11-28 15:42 ` [PATCH v2 1/4] crypto: inside-secure - per request invalidation Antoine Tenart
2017-11-28 15:42 ` [PATCH v2 2/4] crypto: inside-secure - free requests even if their handling failed Antoine Tenart
2017-11-28 15:42 ` [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided Antoine Tenart
2017-11-30  9:19   ` Kamil Konieczny
2017-11-30  9:29     ` Antoine Tenart
2017-11-30 11:52       ` Kamil Konieczny
2017-11-30 12:41         ` Antoine Tenart
2017-11-30 14:10           ` Kamil Konieczny
2017-11-30 14:30             ` Antoine Tenart [this message]
2017-12-01  0:31     ` Herbert Xu
2017-12-01  8:11       ` Antoine Tenart
2017-12-01 10:18         ` Kamil Konieczny
2017-12-01 10:24           ` Antoine Tenart
2017-12-01 10:43             ` Kamil Konieczny
2017-12-01 10:55               ` Antoine Tenart
2017-12-01 10:36           ` Herbert Xu
2017-12-01 11:24             ` Kamil Konieczny
2017-12-01 10:35         ` Herbert Xu
2017-12-01 10:52           ` Antoine Tenart
2017-11-28 15:42 ` [PATCH v2 4/4] crypto: inside-secure - fix request allocations in invalidation path Antoine Tenart

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=20171130143051.GK30391@kwain \
    --to=antoine.tenart@free-electrons.com \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@free-electrons.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=igall@marvell.com \
    --cc=k.konieczny@partner.samsung.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=miquel.raynal@free-electrons.com \
    --cc=nadavh@marvell.com \
    --cc=oferh@marvell.com \
    --cc=thomas.petazzoni@free-electrons.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.