]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Nov 2017 00:22:10 +0000 (16:22 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Nov 2017 00:22:10 +0000 (16:22 -0800)
Pull crypto fixes from Herbert Xu:

 - avoid potential bogus alignment for some AEAD operations

 - fix crash in algif_aead

 - avoid sleeping in softirq context with async af_alg

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  crypto: skcipher - Fix skcipher_walk_aead_common
  crypto: af_alg - remove locking in async callback
  crypto: algif_aead - skip SGL entries with NULL page

1  2 
crypto/skcipher.c

diff --combined crypto/skcipher.c
index d5692e35fab1f069376f7c54358ff5e5f0cb352e,6c45ed536664d34a5a4b1e9a667a7d275b3f236b..778e0ff42bfa801eda5be848da9e6747ebbc2626
@@@ -426,9 -426,14 +426,9 @@@ static int skcipher_copy_iv(struct skci
  
  static int skcipher_walk_first(struct skcipher_walk *walk)
  {
 -      walk->nbytes = 0;
 -
        if (WARN_ON_ONCE(in_irq()))
                return -EDEADLK;
  
 -      if (unlikely(!walk->total))
 -              return 0;
 -
        walk->buffer = NULL;
        if (unlikely(((unsigned long)walk->iv & walk->alignmask))) {
                int err = skcipher_copy_iv(walk);
@@@ -447,15 -452,10 +447,15 @@@ static int skcipher_walk_skcipher(struc
  {
        struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
  
 +      walk->total = req->cryptlen;
 +      walk->nbytes = 0;
 +
 +      if (unlikely(!walk->total))
 +              return 0;
 +
        scatterwalk_start(&walk->in, req->src);
        scatterwalk_start(&walk->out, req->dst);
  
 -      walk->total = req->cryptlen;
        walk->iv = req->iv;
        walk->oiv = req->iv;
  
@@@ -509,11 -509,6 +509,11 @@@ static int skcipher_walk_aead_common(st
        struct crypto_aead *tfm = crypto_aead_reqtfm(req);
        int err;
  
 +      walk->nbytes = 0;
 +
 +      if (unlikely(!walk->total))
 +              return 0;
 +
        walk->flags &= ~SKCIPHER_WALK_PHYS;
  
        scatterwalk_start(&walk->in, req->src);
        scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2);
        scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2);
  
+       scatterwalk_done(&walk->in, 0, walk->total);
+       scatterwalk_done(&walk->out, 0, walk->total);
        walk->iv = req->iv;
        walk->oiv = req->iv;