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:32:57 +0000 (09:32 +0100)
commit57c3e1d63b63dc0841d41df729297cd7c1c35808
treee37f87912d4a9696869d5b13049ab8fad998c508
parentbaffb1a112f72f39e3a9dde85725f3a88c8a9b61
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