linux-stable/include
Mikulas Patocka fd2b627e3f block: change rq_integrity_vec to respect the iterator
[ Upstream commit cf546dd289 ]

If we allocate a bio that is larger than NVMe maximum request size,
attach integrity metadata to it and send it to the NVMe subsystem, the
integrity metadata will be corrupted.

Splitting the bio works correctly. The function bio_split will clone the
bio, trim the iterator of the first bio and advance the iterator of the
second bio.

However, the function rq_integrity_vec has a bug - it returns the first
vector of the bio's metadata and completely disregards the metadata
iterator that was advanced when the bio was split. Thus, the second bio
uses the same metadata as the first bio and this leads to metadata
corruption.

This commit changes rq_integrity_vec, so that it calls mp_bvec_iter_bvec
instead of returning the first vector. mp_bvec_iter_bvec reads the
iterator and uses it to build a bvec for the current position in the
iterator.

The "queue_max_integrity_segments(rq->q) > 1" check was removed, because
the updated rq_integrity_vec function works correctly with multiple
segments.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/49d1afaa-f934-6ed2-a678-e0d428c63a65@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-14 13:52:45 +02:00
..
acpi
asm-generic vmlinux.lds.h: catch .bss..L* sections into BSS") 2024-08-03 08:49:02 +02:00
clocksource
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-01-25 15:27:21 -08:00
drm drm/mipi-dsi: Fix theoretical int overflow in mipi_dsi_dcs_write_seq() 2024-08-03 08:49:10 +02:00
dt-bindings clk: renesas: r8a779g0: Correct PFC/GPIO parent clocks 2024-03-26 18:20:48 -04:00
keys
kunit
kvm KVM: arm64: Fix host-programmed guest events in nVHE 2024-04-10 16:28:23 +02:00
linux block: change rq_integrity_vec to respect the iterator 2024-08-14 13:52:45 +02:00
math-emu
media media: cec: core: avoid recursive cec_claim_log_addrs 2024-06-12 11:03:48 +02:00
memory
misc
net ipv4: Fix incorrect TOS in route get reply 2024-08-03 08:49:24 +02:00
pcmcia
ras
rdma RDMA/core: Fix umem iterator when PAGE_SIZE is greater then HCA pgsz 2023-12-13 18:39:15 +01:00
rv
scsi scsi: mpi3mr: Fix ATA NCQ priority support 2024-06-21 14:35:44 +02:00
soc soc: qcom: rpmh-rsc: Enhance check for VRM in-flight request 2024-06-16 13:41:33 +02:00
sound ALSA: dmaengine: Synchronize dma channel after drop() 2024-07-25 09:49:14 +02:00
target
trace platform/x86/intel/ifs: Gen2 Scan test support 2024-08-14 13:52:43 +02:00
uapi m68k: amiga: Turn off Warp1260 interrupts during boot 2024-08-03 08:49:34 +02:00
ufs
vdso
video
xen xen: simplify evtchn_do_upcall() call maze 2023-12-08 08:51:20 +01:00