]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: skcipher - Unmap pages after an external error
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 6 Sep 2019 03:13:06 +0000 (13:13 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 9 Sep 2019 07:35:27 +0000 (17:35 +1000)
commit51af000f39f61a694279922fa0e855a51d65610a
tree62a5c9b06044d73c4b004c2000ec87b24c319a36
parentde74c659580ca363f31c9c7aeaff478e26c48f4b
crypto: skcipher - Unmap pages after an external error

skcipher_walk_done may be called with an error by internal or
external callers.  For those internal callers we shouldn't unmap
pages but for external callers we must unmap any pages that are
in use.

This patch distinguishes between the two cases by checking whether
walk->nbytes is zero or not.  For internal callers, we now set
walk->nbytes to zero prior to the call.  For external callers,
walk->nbytes has always been non-zero (as zero is used to indicate
the termination of a walk).

Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: 001bdc008e40 ("[CRYPTO] cipher: Added block cipher type")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/skcipher.c