Re: [PATCH] crypto: caam - Add support for hashing export and import functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 17 Oct 2015 10:43:00 +0100
Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx> wrote:

> On Fri, Oct 16, 2015 at 04:19:33PM -0700, Victoria Milhoan wrote:
> > @@ -1569,6 +1601,10 @@ static int ahash_import(struct ahash_request *req, const void *in)
> >  	struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
> >  	struct caam_hash_state *state = ahash_request_ctx(req);
> >  
> > +	/* Allocate new data buffers to use for this request */
> > +	state->buf_0 = kmalloc(CAAM_MAX_HASH_BLOCK_SIZE, GFP_KERNEL | GFP_DMA);
> > +	state->buf_1 = kmalloc(CAAM_MAX_HASH_BLOCK_SIZE, GFP_KERNEL | GFP_DMA);
> > +
> >  	memcpy(ctx, in, sizeof(struct caam_hash_ctx));
> >  	memcpy(state, in + sizeof(struct caam_hash_ctx),
> >  	       sizeof(struct caam_hash_state));
> 
> This is buggy.  You loose the reference to the two buffers you've just
> allocated because this memcpy() overwrites it.

Correct - this was apparently the wrong patch I pushed out. The one I'm actively
using has this fixed (this is the only difference). I will make this change in
v2 after reviewing your other comments.

> 
> -- 
> FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
> according to speedtest.net.


-- 
Victoria Milhoan <vicki.milhoan@xxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux