Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
Subject: Re: HIFN+IPsec crashes in current -git
Date: Thu, 21 Feb 2008 15:20:45 +0100	[thread overview]
Message-ID: <47BD88BD.2030305@trash.net> (raw)
In-Reply-To: <20080221141803.GB24779@2ka.mipt.ru>

Evgeniy Polyakov wrote:
> Hi Herbert.
> 
> On Thu, Feb 21, 2008 at 10:10:13PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
>> Yes by the time the request gets to hifn req->nbytes would have
>> been decremented by 12 bytes which means that it is now the exact
>> amount of data that needs to be encrypted.
>>
>> However, if you follow the scatterlist then you will see more data
>> available which is normal.
> 
> Argh, I see.
> 
> Then following patch should help.
> 
> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> 
> diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
> index dfbf24c..81b8f2f 100644
> --- a/drivers/crypto/hifn_795x.c
> +++ b/drivers/crypto/hifn_795x.c
> @@ -1544,7 +1544,10 @@ static int ablkcipher_walk(struct ablkcipher_request *req,
>  
>  			kunmap_atomic(daddr, KM_SOFTIRQ0);
>  		} else {
> -			nbytes -= src->length;
> +			if (src->length > nbytes)
> +				nbytes = 0;
> +			else
> +				nbytes -= src->length;
>  			idx++;
>  		}
>  

Almost I guess :) There are similar loops in hifn_setup_session().
Additionally we need to check that the return value of ablkcipher_walk()
is not a negative errno code.

  reply	other threads:[~2008-02-21 14:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 13:17 HIFN+IPsec crashes in current -git Patrick McHardy
2008-02-13 14:44 ` Evgeniy Polyakov
2008-02-14  9:30   ` Evgeniy Polyakov
2008-02-19 16:10     ` Patrick McHardy
2008-02-19 16:14       ` Patrick McHardy
2008-02-19  6:23 ` Herbert Xu
2008-02-19 16:27   ` Patrick McHardy
2008-02-20  0:53     ` Herbert Xu
2008-02-20 12:33       ` Patrick McHardy
2008-02-20 13:19         ` Evgeniy Polyakov
2008-02-20 17:29           ` Herbert Xu
2008-02-20 17:26         ` Herbert Xu
2008-02-21  9:10           ` Evgeniy Polyakov
2008-02-21 14:10             ` Herbert Xu
2008-02-21 14:18               ` Evgeniy Polyakov
2008-02-21 14:20                 ` Patrick McHardy [this message]
2008-02-21 14:37                   ` Evgeniy Polyakov
2008-02-21 14:41                     ` Patrick McHardy
2008-02-21 15:29                       ` Patrick McHardy
2008-02-21 15:31                         ` Patrick McHardy
2008-02-22 12:42                         ` Evgeniy Polyakov
2008-02-22 13:53                           ` Patrick McHardy
2008-02-22  2:27               ` Test AES-CCM mode via IPSec (NETKEY) Loc Ho
2008-02-22  5:45                 ` Herbert Xu
2008-03-13 17:34                   ` Loc Ho
2008-03-14  1:12                     ` Herbert Xu
2008-04-04 22:37                     ` Joy Latten
2008-04-04 23:08                       ` Loc Ho

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=47BD88BD.2030305@trash.net \
    --to=kaber@trash.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=johnpol@2ka.mipt.ru \
    --cc=linux-crypto@vger.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