]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 18:04:19 +0000 (19:04 +0100)
commit6371843cb16981c719582a7648ce926fb2abed67
tree0ec10480a4f78f2b4e5651fa160b532b4a476271
parentb4f0282f8ab840157d3017e9f70a49557677db80
crypto: skcipher - Unmap pages after an external error

BugLink: https://bugs.launchpad.net/bugs/1849576
commit 0ba3c026e685573bd3534c17e27da7c505ac99c4 upstream.

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: 5cde0af2a982 ("[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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
crypto/skcipher.c