crypto: xts - Handle EBUSY correctly
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 22 Jan 2023 08:07:37 +0000 (16:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:13 +0000 (09:39 +0100)
commit912eb10b65646ffd222256c78a1c566a3dac177d
tree434ba2ebd13665183d3de5d5df0b8d84cb3978b8
parent55a7f88059c88cd6737af0ca17c6cba92ac72ec3
crypto: xts - Handle EBUSY correctly

[ Upstream commit 51c082514c2dedf2711c99d93c196cc4eedceb40 ]

As it is xts only handles the special return value of EINPROGRESS,
which means that in all other cases it will free data related to the
request.

However, as the caller of xts may specify MAY_BACKLOG, we also need
to expect EBUSY and treat it in the same way.  Otherwise backlogged
requests will trigger a use-after-free.

Fixes: 8083b1bf8163 ("crypto: xts - add support for ciphertext stealing")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
crypto/xts.c