No description
Find a file
Olivier Bacon 0435cf0500 crypto: engine - fix crypto_queue backlog handling
[ Upstream commit 4140aafcff ]

CRYPTO_TFM_REQ_MAY_BACKLOG tells the crypto driver that it should
internally backlog requests until the crypto hw's queue becomes
full. At that point, crypto_engine backlogs the request and returns
-EBUSY. Calling driver such as dm-crypt then waits until the
complete() function is called with a status of -EINPROGRESS before
sending a new request.

The problem lies in the call to complete() with a value of -EINPROGRESS
that is made when a backlog item is present on the queue. The call is
done before the successful execution of the crypto request. In the case
that do_one_request() returns < 0 and the retry support is available,
the request is put back in the queue. This leads upper drivers to send
a new request even if the queue is still full.

The problem can be reproduced by doing a large dd into a crypto
dm-crypt device. This is pretty easy to see when using
Freescale CAAM crypto driver and SWIOTLB dma. Since the actual amount
of requests that can be hold in the queue is unlimited we get IOs error
and dma allocation.

The fix is to call complete with a value of -EINPROGRESS only if
the request is not enqueued back in crypto_queue. This is done
by calling complete() later in the code. In order to delay the decision,
crypto_queue is modified to correctly set the backlog pointer
when a request is enqueued back.

Fixes: 6a89f492f8 ("crypto: engine - support for parallel requests based on retry mechanism")
Co-developed-by: Sylvain Ouellet <souellet@genetec.com>
Signed-off-by: Sylvain Ouellet <souellet@genetec.com>
Signed-off-by: Olivier Bacon <obacon@genetec.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-06 18:37:47 +08:00
arch RISC-V: mm: Enable huge page support to kernel_page_present() function 2023-06-06 18:37:44 +08:00
block blk-crypto: make blk_crypto_evict_key() more robust 2023-06-06 18:34:51 +08:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2023-04-19 17:50:34 +08:00
crypto crypto: engine - fix crypto_queue backlog handling 2023-06-06 18:37:47 +08:00
Documentation riscv: Move early dtb mapping into the fixmap region 2023-06-06 18:19:52 +08:00
drivers crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs() 2023-06-06 18:37:47 +08:00
fs writeback: fix call of incorrect macro 2023-06-06 18:37:44 +08:00
include crypto: api - Add scaffolding to change completion function signature 2023-06-06 18:37:47 +08:00
init kbuild: Add CONFIG_PAHOLE_VERSION 2023-04-19 17:59:33 +08:00
io_uring io_uring: avoid null-ptr-deref in io_arm_poll_handler 2023-04-19 18:00:57 +08:00
ipc ipc/sem: Fix dangling sem_array access in semtimedop race 2023-04-19 17:56:54 +08:00
kernel ring-buffer: Ensure proper resetting of atomic variables in ring_buffer_reset_online_cpus 2023-06-06 18:37:41 +08:00
lib debugobject: Ensure pool refill (again) 2023-06-06 18:37:33 +08:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
mm writeback, cgroup: fix null-ptr-deref write in bdi_split_work_to_wbs 2023-06-06 18:34:53 +08:00
net af_packet: Don't send zero-byte data in packet_sendmsg_spkt(). 2023-06-06 18:37:46 +08:00
samples samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe() 2023-04-19 17:57:46 +08:00
scripts scripts/gdb: fix lx-timerlist for Python3 2023-06-06 18:37:32 +08:00
security selinux: ensure av_permissions.h is built when needed 2023-06-06 18:37:04 +08:00
sound ALSA: caiaq: input: Add error handling for unsupported input methods in snd_usb_caiaq_input_init 2023-06-06 18:37:46 +08:00
tools perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp() 2023-06-06 18:37:47 +08:00
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage 2023-04-19 17:44:58 +08:00
virt KVM: fix memoryleak in kvm_init() 2023-04-19 18:00:47 +08:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap mailmap: add Andrej Shadura 2021-10-18 20:22:03 -10:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: Move Daniel Drake to credits 2021-09-21 08:34:58 +03:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS counter: Internalize sysfs interface code 2023-06-06 18:05:09 +08:00
Makefile Linux 5.15.111 2023-06-06 18:37:33 +08:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.