lkml.org 
[lkml]   [2008]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 23/76] CRYPTO xcbc: Fix crash with IPsec
    -stable review patch.  If anyone has any objections, please let us know.
    ---------------------

    From: Joy Latten <latten@austin.ibm.com>

    [ Upstream commit: 2f40a178e70030c4712fe63807c883f34c3645eb ]

    When using aes-xcbc-mac for authentication in IPsec,
    the kernel crashes. It seems this algorithm doesn't
    account for the space IPsec may make in scatterlist for authtag.
    Thus when crypto_xcbc_digest_update2() gets called,
    nbytes may be less than sg[i].length.
    Since nbytes is an unsigned number, it wraps
    at the end of the loop allowing us to go back
    into loop and causing crash in memcpy.

    I used update function in digest.c to model this fix.
    Please let me know if it looks ok.

    Signed-off-by: Joy Latten <latten@austin.ibm.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Chris Wright <chrisw@sous-sol.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    crypto/xcbc.c | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    --- a/crypto/xcbc.c
    +++ b/crypto/xcbc.c
    @@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(st
    unsigned int offset = sg[i].offset;
    unsigned int slen = sg[i].length;

    + if (unlikely(slen > nbytes))
    + slen = nbytes;
    +
    + nbytes -= slen;
    +
    while (slen > 0) {
    unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
    char *p = crypto_kmap(pg, 0) + offset;
    @@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(st
    offset = 0;
    pg++;
    }
    - nbytes-=sg[i].length;
    i++;
    } while (nbytes>0);

    --


    \
     
     \ /
      Last update: 2008-03-21 23:55    [W:9.163 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site